Simple windowed application: Difference between revisions

m
No edit summary
Line 1,237:
using Gtk.ShortNames
 
"""
gtkwait
Keeps the application visible and running until dismissed.
"""
function gtkwait(window)
if !isinteractive()
c = Condition()
endit(w) = notify(c)
signal_connect(endit, window, :destroy)
end
wait(c)
end
 
"""
clickwindow
A simple window test.
"""
function clickwindow()
clicks = 0
win = Window("Click Counter", 300, 100) |> ((frm = Frame())|> (vbox = Box(:v)))
txt = "There have been no clicks yet."
winlab = WindowLabel("ClickThere Counter",have 300,been 100)no |>clicks (frm = Frame(yet."))
vbox = Box(:v)
push!(frm, vbox)
lab = Label(txt)
push!(vbox, lab)
but = Button("click me")
push!(frmvbox, vboxlab)
push!(vbox, but)
setproperty!(vbox, :expand, lab, true)
Line 1,268 ⟶ 1,249:
callback(w) = (clicks += 1; setproperty!(lab, :label, "There have been $clicks button clicks."))
id = signal_connect(callback, but, "clicked")
c = Condition()
endit(w) = notify(c)
signal_connect(endit, windowwin, :destroy)
showall(win)
gtkwaitwait(winc)
end
 
4,105

edits