Posted to tcl by xharx at Thu Mar 04 20:05:35 GMT 2021view raw
- proc buttoncommand {} {
- quit
- destroy .
- }
- proc new {} {
- global done
- set done 0
- after 1000 set done 1
- while {! $done} {
- set newtext "foo"
- global ltext
- set ltext $newtext
- update
- }
- set ltext "bar"
- puts $done
- }
- proc new2 {} {
- set done 0;
- after 1000 {set done 1}
- set ::ltext2 1
- proc handler {} {
- incr ::ltext2
- set ::ev
- [after 10 handler]
- }
- handler vwait done
- after cancel $::ev
- set ::ltext "done"
- }
- listbox .l1 -width 50 -height 10 -listvariable ltext
- pack .l1
- listbox .l2 -width 50 -height 10 -listvariable ::ltext2
- pack .l2
- button .b1 -text "ok" -command {quit}
- button .b2 -text "update" -command {new}
- button .b3 -text "update2" -command {new2}
- pack .b1
- pack .b2
- pack .b3