[python-win32] python win32 demos question

Chris R. Martin bluedust at swbell.net
Wed Jan 19 02:19:23 CET 2005


In the win32\demos directory, there is a script called 
win32gui_dialog.py. Near the end of this script, there are the following 
lines:

def DemoModal():
    w=DemoWindow()
    w.DoModal()
##    w.CreateWindow()
##    win32gui.PumpMessages()
##    # Not sure how to kill this loop.

I realize that CreateWindow() and PumpMessages() is not needed by a 
dialog since dialogs have a "built-in" window procedure. However, the 
comment does seem to be correct - using a PumpMessages() loop does NOT 
end the python process when this function supposedly exits. In fact, it 
seems like this function never returns, even when the main window is 
closed. Shouldn't it?

http://aspn.activestate.com/ASPN/docs/ActivePython/2.4/pywin32/win32gui_.28more.29__PumpMessages_meth.html

How does one write a windows procedure and properly handle messages in a 
loop using win32 python? Do I need to manually do this? Maybe create a 
new thread for the rest of the program and sit and spin for messages in 
the main thread? Or maybe vice versa?

Any examples of Python using a GUI/main loop?

Thanks,
Chris

-- 
Guybrush: How can you see without eyeballs?
Murray: How can you walk around without a brain? Some things no one can 
answer.


More information about the Python-win32 mailing list