Sandy Walsh schrieb: > Hey all (again), congrats on 0.5.3! Thanks!
> I can't seem to get apps by using GetEvents(), but ShowEvents() works fine. > > My app is running in wxpython app and, hopefully, gets its event pump > from the wx.MainLoop() > > I have a simple window that holds my ActiveX control: > > app = wx.App(False) > frame = wx.Frame(None) > activeX = MyActiveXControlWindow(frame) > control = activeX.ctrl > frame.Show() > app.MainLoop() > > Somewhere during the running of the app, this gets called: > > class MySink(object): > def _IFooEvents_RecordingStops(self): > print "_IFooEvents_RecordingStops" > > ... > sink = MySink() > connection = GetEvents(control, sink = MySink()) > ... > > > But I never get any calls on MySink of any kind. > > However, if I replace the GetEvents() with a ShowEvents() not only do > the possible Events list but I get my notifications that a given event > is generated (like MouseOver). If an exception happens in your event handler (before something is printed), or an exception happens calling your event handler (for example if it is called with more or less arguments than it expects), then comtypes catches the exception and logs an error via Pythons logging module. So, to see the exceptions if there are any, you must configure logging to not swallow the exceptions silently. Adding these lines at the top of your script should work, for example: import logging; logging.basicConfig(level=logging.ERROR) I have attached another script that shows this behaviour. > Looking at the _events.py code, I can't even see where the PumpEvents() > is being done in ShowEvents(), but that's another question. Some events require a message loop so that they are delivered, others not. To be sure that events are delivered, an event loop is required (in single threaded apartments at least). -- Thanks, Thomas ------------------------------------------------------------------------------ SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ _______________________________________________ comtypes-users mailing list comtypes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/comtypes-users