|
|
|
|
|
by rwmj
1957 days ago
|
|
The way Tcl/Tk dealt with this was nice: You could watch the value in a variable, getting notified when the variable changed. GUI controls could therefore exactly reflect the content of variables. Of course this comes with a certain hidden overhead. This complete example will toggle the checkbox every second (1000ms), or the user can click to update the variable. The checkbox watches variable "v". #!/usr/bin/wish
checkbutton .button -variable v -text "Click me"
pack .button
proc run {} {
global v
after 1000 run
set v [expr !$v]
}
run
|
|