问题
vwait forever runs the events loop until the exit
command.
I have some stuff to do during each iteration of the event loop. How can I do that?
回答1:
You don't. What you do is schedule regular timer events that do your work. For user interaction, 10 times a second is quite regular enough. To schedule regular timer events, use the every command from the Tcler's Wiki, like this:
proc every {ms body} {after $ms [info level 0]; eval $body}
every 100 {
puts "I'm saying Hi ten times a second!"
}
That's the simplest form of every
; more complex cancelable versions are further down that wiki page.
来源:https://stackoverflow.com/questions/8750357/how-can-i-make-a-given-script-to-be-evaluated-after-each-iteration-in-vwait-fore