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

Discussion in 'Python' started by James Hu, Oct 27, 2005.

  1. James Hu

    James Hu Guest

    Thanks a lot!

    -----Original Message-----
    From: Mark Hammond [mailto:]
    Sent: Wednesday, October 26, 2005 7:16 PM
    To: James Hu; ;
    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,
    but
    are implemented in C. There are versions of these functions in win32gui
    and
    win32ui. win32ui is the MFC wrapper, and its version does do it the
    "MFC
    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.

    Mark
    -----Original Message-----
    From:
    [mailto:p]On Behalf Of James Hu
    Sent: Thursday, 27 October 2005 4:10 AM
    To: ;
    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?

    DoEvents()
    {
    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,
    James
    James Hu, Oct 27, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. MichaelR

    DoEvents Equivalent?

    MichaelR, Jan 24, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    7,254
    bruce barker
    Jan 24, 2005
  2. Mark Hammond
    Replies:
    0
    Views:
    635
    Mark Hammond
    Oct 27, 2005
  3. OziRus
    Replies:
    4
    Views:
    5,486
    Daniel Pitts
    Mar 8, 2007
  4. Dennis Eklund

    DoEvents in ASP?

    Dennis Eklund, Feb 8, 2004, in forum: ASP General
    Replies:
    1
    Views:
    444
    Bob Barrows
    Feb 8, 2004
  5. Biju
    Replies:
    1
    Views:
    122
    Thomas Kratz
    May 29, 2006
Loading...

Share This Page