tkwait , a built-in Tk command, runs the event loop while waiting for something to happen (as described by its arguments).

See Also

update considered harmful
On the hazards of entering the event loop.
Similar to tkwait variable.


tkwait variable name
tkwait visibility name
tkwait window name


While the tkwait is waiting it processes events in the normal fashion, so the application will continue to respond to user interactions. If an event handler invokes tkwait again, the nested call to tkwait must complete before the outer call can complete.

Global Scoping

Another reminder to read the man page carefully: "If the first argument is variable (or any abbreviation of it) then the second argument is the name of a global variable and the command waits for that variable to be modified."