« The Horse goes on and on | Main | Using Tcl/Tk resource files for flexible applications »
December 15, 2007
Making a variable dynamically visible in a Tcl/Tk GUI
set bill "and Ben"
label .about -textvariable bill
button .first -text "First" -command {set bill Bradshaw}
button .second -text "Second" -command {set bill Bailey}
button .done -text quit -command exit
pack .about .first .second .done
Tcl/Tk's -textvariable option, on commands like label and button, allows you to have the contents of a variable display within you GUI (Graphic User Interface) ... and simply changing the value in the variable will change your display.
Quick, elegant, easy to program and easy to maintain.
Posted by gje at December 15, 2007 09:45 PM