RosettaCodeData/Task/Simple-windowed-application/TAV/simple-windowed-application.tav
2025-08-11 18:05:26 -07:00

23 lines
692 B
Text

\ the GTK objects can have fields, so no global is needed
click (btn) with (label):
btn.clicked =+ 1
label::label text "Clicked" __ btn.clicked __ "times."
setup main window:
win =: new GTK window
win::set title "Button Demo"
win::set size 150, 100
win::connect 'destroy' to `GTK main quit`
box =: new GTK container box 'vertical' spacing 2
win::add container box
msg =: new GTK widget label "Not yet any click, click the button..."
box::add widget msg
button =: new GTK widget button "Click here"
button.clicked =: 0
button::connect 'clicked' to `click () with ()` with msg
box::add widget button
win::show all
:>win
main (args):+
GTK init args
GTK main setup main window