Simple windowed application: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 1,231: | Line 1,231: | ||
} |
} |
||
}</lang> |
}</lang> |
||
=={{header|Julia}}== |
|||
Uses the Gtk library. |
|||
<lang Julia> |
|||
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 |
|||
txt = "There have been no clicks yet." |
|||
win = Window("Click Counter", 300, 100) |> (frm = Frame()) |
|||
vbox = Box(:v) |
|||
push!(frm, vbox) |
|||
lab = Label(txt) |
|||
push!(vbox, lab) |
|||
but = Button("click me") |
|||
push!(vbox, but) |
|||
setproperty!(vbox, :expand, lab, true) |
|||
setproperty!(vbox, :spacing, 20) |
|||
callback(w) = (clicks += 1; setproperty!(lab, :label, "There have been $clicks button clicks.")) |
|||
id = signal_connect(callback, but, "clicked") |
|||
showall(win) |
|||
gtkwait(win) |
|||
end |
|||
clickwindow() |
|||
</lang> |
|||
=={{header|Kotlin}}== |
=={{header|Kotlin}}== |