Responding to a custom event

I've got kind of a unique situation. I'm running an embedded
Python interpreter in the main thread, that is using wxPython,
but I have a monitor thread in C++ that is watching for messages
from a CORBA connection. When messages are received they are
shunted to a thread-safe message queue. I then use ::PostMessage()
to send a custom event to the main window of the application so
it knows to service the message queue, because I want this to
be initiated from the wxPython event system.

I'm having trouble getting the event handling for the custom event
set up in the wxpython-based scripts. I'm using the EvtHandler.Connect()
function to try to set up the event handler in wxPython, but it never
seems to be triggered. I'm kind of at a loss on how to debug this.

Any thoughts would be greatly appreciated!

···

-----------------------------------------------------------------
Jeff Kotula System Architecture
jkotula@vitalimages.com

I was reading the dictionary. I thought it was a poem
about everything.
   -- Steven Wright

Jeff Kotula wrote:

I've got kind of a unique situation. I'm running an embedded
Python interpreter in the main thread, that is using wxPython,
but I have a monitor thread in C++ that is watching for messages
from a CORBA connection. When messages are received they are
shunted to a thread-safe message queue. I then use ::PostMessage()
to send a custom event to the main window of the application so
it knows to service the message queue, because I want this to
be initiated from the wxPython event system.

I'm having trouble getting the event handling for the custom event
set up in the wxpython-based scripts. I'm using the EvtHandler.Connect()
function to try to set up the event handler in wxPython, but it never
seems to be triggered. I'm kind of at a loss on how to debug this.

There is no way in wxPython to capture specific platform messages/events and turn them into a wxEvent if they are not already handled by the toolkit. However it is possible on Windows to use one of the win32all modules to hook in the the WndProc of a window and handle your posted message there allowing all otheres to be handled by the wxWindows WndProc. I don't have the details in front of me but I know it has been done int he past. (It would be nice to have a recipie in the wiki for this.)

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!