On Mon, Aug 20, 2018 at 1:11 PM <[email protected]> wrote:

> Hello. I have been trying to find a way to run a function when the mouse
> is on top of a button. I tried to overrride the QPushButton class, and the
> enterEvent function, but I dont have any results. This is what I have:
>
> class CustomButtom(QtGui.QPushButton):
>
>     def __init__(self):
>         pass
>

You broke the constructor by overriding it and not calling the parent
constructor. Either remove this, or do:

    super(CustomButtom, self).__init__()


>     def mouseMoveEvent(self, event):
>         print("in focus")
>
>     def enterEvent(self, event):
>         print("Enter")
>
>     def leaveEvent(self, event):
>         print("Leave")
>
> I have an extra function to create the buttons, and in there I set the
> setMouseTracking(1) to 1.
>
> What am I missing?. My guess is that I need to connect the enter and and
> leave event, but, to who?I thought they would be connected to the mouse
> movement already.
>
> Thanks.
>
> --
> 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/693291aa-7811-42ad-8660-3e51b25ebe3c%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAPGFgA0EqWmh-v4T-BUfi7xLpwMv%2BzZ3xo_DwFT3ZMyBH1WBVQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to