Tkinter: update_idletasks
Eric Brunel
eric_brunel at despammed.com
Fri May 21 04:12:42 EDT 2004
Jeffrey Barish wrote:
> I'm confused about how to use the update_idletasks method. In my
> program, I have a handler for a button in which execution will linger.
> During that time, I would like for the GUI to continue to show signs of
> life. I have a Pmw MessageBar in which I display a status message. I
> figured out that if I run update_idletasks on that MessageBar, then the
> MessageBar will update the display as I update the message. However,
> if I cover the GUI with some other window and then expose it again, the
> GUI does not refresh until the handler finishes (except for the
> MessageBar). Do I have to run the update_idletasks method for every
> widget in the GUI? for all the frames? for just the root frame? Or is
> it impossible to get the GUI to refresh in this situation?
At tcl level, update_idletasks isn't a "method", i.e. the tcl command doesn't
take any parameter telling which widget to refresh. So calling the Tkinter
update_idletasks method on any widget has exactly the same effect, which is to
refresh the whole GUI.
There are some issues on Windows however, where the newly created toplevel's may
not refresh until full control is returned to the GUI. To work around this
problem, use the wait_visibility method to wait until the newly created window
is displayed. But be careful: wait_visibility processes events, unlike
update_idletasks that does just a GUI refresh. There is apparently no simple way
of updating the display of newly created toplevel's on Windows without returning
full control to the GUI (at least with tk/Tkinter)
I never saw the problem you describe (some windows refreshing, some not), but I
mainly develop on Linux, which may show a different behaviour than the platform
you're working on (which BTW you don't mention...). Maybe you can post a small
piece of code showing the problem?
HTH
--
- Eric Brunel <eric (underscore) brunel (at) despammed (dot) com> -
PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com
More information about the Python-list
mailing list