Is that the full code? I can't see where you're installing the filter. Don't forget to run installEventFilter() on the target object.
Have a look at this example. https://gist.github.com/mottosso/ce114dfe4a264b52e235 On 10 November 2014 07:29, Arvid Schneider <[email protected]> wrote: > Thanks for all the help! > But dont get an error now. But its still not working. > > > class HyperShadeEventFilter(QtCore.QObject): > def __init__(self): > super(HyperShadeEventFilter, self).__init__() > ptr = mui.MQtUtil.mainWindow() > mainWin = shiboken.wrapInstance(long(ptr), QtGui.QWidget) > mainWin.installEventFilter(self) > > def eventFilter(self, object, event): > print event.type() > if event.type() == event.Type.ChildPolished: > child = event.child() > print child.objectName() > if 'hyperShadePanel' in child.objectName(): > print 'OPEN' > elif event.type() == event.Type.ChildRemoved: > child = event.child() > if 'hyperShadePanel' in child.objectName(): > print 'CLOSE' > HyperShadeEventFilter() > > -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/python_inside_maya/45b59ddf-16ce-4434-a356-0d1179bb6114%40googlegroups.com > <https://groups.google.com/d/msgid/python_inside_maya/45b59ddf-16ce-4434-a356-0d1179bb6114%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- *Marcus Ottosson* [email protected] -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODwawJi0dKjmBa%3DqGnwgffbzTs9MPXX1MO9g1pQAPNodA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
