I want to insert sleep for 30 second in my TCL script.
I tried using sleep command. but its not working. could any one of you help on this?
You have to use
after 30000
The argument to after
is interpreted as milliseconds.
While asking a question, if you insert your code, that will be useful for others.
As previously stated by Donal Fellows in the comments, rcubefather's solution will halt event processing while sleeping.
Here's a slightly different approach I use is:
after 30000 set stop_wait &
vwait stop_wait
unset stop_wait
This will put the 'after 30000' command in background (&) waiting for 'stop_wait' variable to be set, while any other event processing will not be halted. This behavior is much more evident working with Tk GUI. However this will not prevent 'vwait' command from catching up the variable when set, allowing this portion of code to proceed. Not CPU intensive as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With