Tags: doevents, hammond, lot-original, mailtomhammond, mark, message-from, programming, python, python-win32, simulate, skippinet, todaysummary, wxpython

[python-win32] simulate DoEvents by python/wxpython

On Programmer » Python

2,300 words with 0 Comments; publish: Sun, 30 Dec 2007 23:23:00 GMT; (20031.25, « »)

Thanks a lot!

--Original Message--

From: Mark Hammond [mailto:mhammond.python.todaysummary.com.skippinet.com.au]

Sent: Wednesday, October 26, 2005 7:16 PM

To: James Hu; Python-win32.python.todaysummary.com.python.org; python-list.python.todaysummary.com.python.org

Subject: RE: [python-win32] simulate DoEvents by python/wxpython

Build 205 of win32gui does have PeekMessage etc so you can now write the

message loop in Python should the need arise - however, the various

"PumpMessages" and "PumpWaitingMessages" functions do the same thing,


are implemented in C. There are versions of these functions in win32gui


win32ui. win32ui is the MFC wrapper, and its version does do it the


way", as opposed to the vanilla Windows way that win32gui exposes. Your

code below looks like it is MFC based, so the win32ui versions may work

better for you (eg, work correctly with the MFC idle processing). If

you do

truly only need VB DoEvents style processing (which is not MFC aware),

win32gui.Pump(Waiting)Messages should be fine though.


--Original Message--

From: python-win32-bounces.python.todaysummary.com.python.org

[mailto:python-win32-bounces.python.todaysummary.com.python.org]On Behalf Of James Hu

Sent: Thursday, 27 October 2005 4:10 AM

To: Python-win32.python.todaysummary.com.python.org; python-list.python.todaysummary.com.python.org

Subject: [python-win32] simulate DoEvents by python/wxpython

Hi, all gurus,

I need to simulate DoEvents in VB by python/wxPython,

My application needs to capture live image in a loop until one specific

button pressed

Multi-thread is also not very good solution, for there are big number of

data to exchange between the two threads.

Win32gui doesn't have PeekMessage.

Or translate the folllowinf codes to python?



MSG msg;

while ( ::PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) )


if ( !PumpMessage( ) )


::PostQuitMessage( 1 );

return FALSE;



// let MFC do its idle processing

LONG lIdle = 0;

while ( OnIdle(lIdle++ ) )


return TRUE;



Thanks in advance,


All Comments

Leave a comment...