On Wednesday 23 October 2002 7:28 pm, Konrad Hinsen wrote: > > They may be filtered out by the widget that has focus, it's hard to > > At least they never appear in keyPressEvent(), neither for the main > widget nor for the widget in focus. > > > tell. If you want to make sure that you catch all the tab key events, > > have a look at QObject::eventFilter() and QObject::installEventFilter(). > > I tried that, but how does one define an event filter in Python? > Here is what I tried: > > class FilterObject(QObject): > > def eventFilter(self, object, event): > sys.stderr.write(repr(object) + ':' + repr(event) + '\n') > return 1 > > app = QApplication(sys.argv) > ... > app.installEventFilter(FilterObject()) > ... > app.exec_loop() > > This doesn't crash, but doesn't do anything either, the event filter > routine is never called.
That's because you aren't keeping a reference to the FilterObject instance so it gets garbage collected immediately. Phil _______________________________________________ PyKDE mailing list [EMAIL PROTECTED] http://mats.gmd.de/mailman/listinfo/pykde
