🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

github.com/hultan/dialog

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/hultan/dialog

v1.0.8
Source
Go
Version published
Created
Source

DIALOG

A simple message dialog package.

Usage:

This package needs GoTK3 (GTK) to run (see link below), and you will need to run gtk.Init() somewhere in your application, before using the dialogs.

	// Initialize gtk
gtk.Init(&os.Args)

_, _ = dialog.Title("A custom icon!").
    Text("This is a custom icon, really?").
    Extra(getLongText()).
    ExtraHeight(200).
    CustomIcon("./example/assets/armour.png").
    HeaderColor("#6879D0FF").
    OkButton().
    Size(300, 50).
    Show()

_, _ = dialog.Title("Hello World!").
    TextMarkup("<span foreground=\"black\">How are you <i><b>today</b></i>?</span>`5").
    InfoIcon().
    OkButton().
    Size(300, 100).
    Show()

_, _ = dialog.Title("No image dialog!").
    Text("How are you today?").
    Extra(getLongText()).
    ExtraHeight(50).
    ExtraName("Extra name test").
    OkButton().
    Height(100).
    Show()

response, _ := dialog.Title("Hello World!").
    Text("How are you today?").
    Extra(getLongText()).
    ExtraHeight(50).
    QuestionIcon().
    YesNoButtons().
    Height(125).
    Show()

if response == gtk.RESPONSE_YES {
    _, _ = dialog.Title("Your response...").
    Text("...was affirmative!").
    WarningIcon().
    OkButton().
    Show()
} else {
    _, _ = dialog.Title("Your response...").
    Text("...was very negative!").
    ErrorIcon().
    OkButton().
    Show()
}

IMAGES

dialog1 dialog2

dialog4 dialog3

dialog5 dialog6

  • Source of inspiration: https://github.com/sqweek/dialog
  • GoTK3 : https://github.com/gotk3/gotk3

TODO

  • Choose between smaller and larger icons. Currently probably only look ok if the icons are 32x32 (PNG).
  • Handle line breaks in text

FAQs

Package last updated on 29 May 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts