Your thread probably needs to be running an event loop - I'm not sure how this is usually spelt in wx, but the 'usual' pythoncom.PumpMessages or similar might be enough.

Cheers,

Mark

On 10/09/2009 1:15 PM, Jeff Peery wrote:
Hello,
I'm having trouble catching events from my multi threaded app. I'm using
wxpython and running several threads under the main wxApp thread. One of
the threads creates a COM object for an OPC server. I'm using
dispatchWithEvents() to get the COM object. When I do this the server
will post an event to the OnDataChange() method in my application.
Everything runs wonderfully when I create the COM object within the main
thread (wxApp). However if I create it from within a sub thread then the
OnDataChange is not being called.
My understanding of how multithreaded applications work is basic. I'm
using queue's and threading.locks to safely manage data. However I don't
understand how messages and events are handled in multi threaded apps
with different apartments. The COM object I created is a client to an
OPC server. I suspect the server lives in a different apartment and that
I must handle how messages and events are passed between different
threads/apartments.
Where should I start reading to learn more and/or is there a standard
way to assure my events get posted across apartments/threads?
thanks,
Jeff



------------------------------------------------------------------------

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to