Version 1 of after idle

Updated 2005-03-21 08:42:43

after idle script ?script script ...?

Concatenates the script arguments together with space separators (just as in the concat command), and arranges for the resulting script to be evaluated later as an idle callback. The script will be run exactly once, the next time the event loop is entered and there are no events to process. The command returns an identifier that can be used to cancel the delayed command using after cancel. If an error occurs while executing the script then the bgerror mechanism is used to report the error.

A typical use of this command (and perhaps the most important one) is when you need to keep a GUI alive during a long calculation. This is often done with the update command, but this slows down your computation and update is no good choice because: Update considered harmful. Instead use something like

 after idle [list after 0 $myCommand]

See also:


Category Command - Tcl syntax help