DoEvents equiv?

Fredrik Lundh fredrik at pythonware.com
Fri May 11 07:42:18 EDT 2001


Mark:
> >It really depends on the GUI system you are running.  In many cases,
> >PumpMessages in either win32ui, win32gui or pythoncom will do the job.
> >For a Tkinter app, it will be something different, but I don't know what
> >that is.

update() processes all outstanding events.

Costas:
> I thought thats what time.sleep(x.xx) did? It relinquishes control to
> the OS..

yeah, but the problem here is that on Windows, your process is not
only responsible for keeping its window updated, it also does many
of the window manager duties (through a default event handler that
you have to call from your event loop).

To see what happens, try running this little program.  On a Windows
box, you cannot even move the window around.

from Tkinter import *

root = Tk()
root.update() # clear the event queue

while 1:
    pass

Cheers /F





More information about the Python-list mailing list