Mike Driscoll wrote: > Tim Roberts wrote: >> Jeff Peery wrote: >> >>> 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. >> >> Every thread in a Windows application has its own message queue. If you >> create a COM object in a different thread, then its messages will all be >> delivered to that thread's queue. However, wxPython is only responding >> to messages on the main thread, where you created the window. > > I'm probably being naive, but I think using wx.CallAfter or > wx.CallLater in combination with pubsub > (http://wiki.wxpython.org/PubSub) would be one of the easiest ways to > send messages back to your application.
That's good advice in general, but the issue, I think, is that it's not his app that is generating these events. He has what I assumed was a foreign COM object being created in a secondary thread. He's going to need to have someone listening to events on that thread to forward them back to his app's main thread. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32