[Tkinter-discuss] how to wait for user input?

Jeff Epler jepler at unpythonic.net
Fri Oct 8 03:32:23 CEST 2004


You can use .grab_set() (force keyboard and mouse events to a single window
in the application) and .wm_transient() (give the window the appearance
of a "transient" window aka "dialog" or "secondary window, and force it
to appear above the main application window in stacking order).

To wait for "something to happen", you can use wait_window (handles
events and returns when the window is destroyed) or wait_variable
(handles events and returns when the value of a variable is changed),
or you can have the command= of the OK and Cancel buttons perform the
action, destroy or hide the window, and release the grab, and use
neither of the above.

.grab_release() will let the main window handle events again.
Destroying the secondary window would automatically release grab.  I
don't know whether merely withdrawing it would.

Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.python.org/pipermail/tkinter-discuss/attachments/20041007/cb4b10ff/attachment.pgp


More information about the Tkinter-discuss mailing list