Skip to content

Instantly share code, notes, and snippets.

@goropikari
Created January 5, 2018 16:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goropikari/8f61d9484f73cb7a89325c4e3dc7aaca to your computer and use it in GitHub Desktop.
Save goropikari/8f61d9484f73cb7a89325c4e3dc7aaca to your computer and use it in GitHub Desktop.

Glade

ui = Builder(filename="foo.glade")

GtkButton

getproperty(widget, :label, String)
signal_connect(widget -> foo(widget), widget, "clicked")

GtkImageMenuItem

signal_connect((x,y)-> foo(), widget, :activate, Void, (), false)

GtkEntry

getproperty(widget, :text, String)
setproperty!(widget, :text, "foo")
signal_connect(widget->foo(widget), widget, "activate")

GtkTextView

# Write string on GtkTextView
getproperty(textview, :buffer, GtkTextBuffer) |> x -> setproperty!(x, :text, s)

# Get string from GtkTextView
getproperty(textview, :buffer, GtkTextBuffer) |> x -> getproperty(x, :text, AbstractString)

GtkLabel

setproperty!(widget, :use_markup, true)
getproperty(widget, :label, String)

GtkImage

setproperty!(widget, :file, "filename")

GtkCheckButton

getproperty(widget, :active, Bool)

dialog

info_dialog("foo")
open_dialog("Open file", ui["win"], ("*.txt", "*",)) # where ui["win"] is GtKWindow
save_dialog("Save file")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment