but I still have no results when my cursor hovers on top of the button:
This works for me.
from PySide import QtGui
class CustomButtom(QtGui.QPushButton):
def enterEvent(self, event):
print("Enter")
def leaveEvent(self, event):
print("Leave")
button = CustomButton()
button.show()# Enter# Leave
On Mon, 20 Aug 2018 at 12:15, Justin Israel <[email protected]> wrote:
>
>
> On Mon, Aug 20, 2018, 2:40 PM <[email protected]> wrote:
>
>> here is the code:
>>
>> https://pastebin.com/tii0rR1M
>>
>> thanks again.
>>
>
> Ok now I see your problem. Thanks for providing a more complete example.
> You have defined your custom event logic on your CustomButtom class, but
> then you have your createWindowsFunction() create a local instance which
> you don't save, and then you call buttonCreator() which creates a
> completely generic button parented to the Maya main window. That function
> doesn't return anything so you just end up setting self.windowNorthButton
> to None. Then you let your local CustomButtom go unsaved and get garbage
> collected.
> I actually don't even know how this code works correctly but I will only
> focus on your original question. You aren't operating on your CustomButtom
> logic. You just use it to create another generic QPushButton. So the
> solution is to create and save an instance of your custom class instead.
>
> What I meant about your __init__() is that in its current state it isn't
> helping you and actually making your CustomButtom less useful by not
> letting you do CustomButtom("text", main Window). Better to just remove it
> entirely if it isn't going to do anything useful.
>
>
>
>> --
>> 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/c1fd2da1-c565-44a4-88f7-eeabee24317b%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/CAPGFgA2tywvG4xg4Vg65Bwf%2B6Vq1iZukOu7EQBEnr_3tTAn%2B%3DQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2tywvG4xg4Vg65Bwf%2B6Vq1iZukOu7EQBEnr_3tTAn%2B%3DQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> 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/CAFRtmOB%2B0Ux7U%2Bq3yHY1BVsRHM2meSb0WNNfS-xL8KEuATwVXg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.