How can I make a given script to be evaluated after each iteration in vwait forever?

徘徊边缘 提交于 2019-12-12 01:52:42

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!