o***@gmail.com
2018-08-20 00:01:31 UTC
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
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.
class CustomButtom(QtGui.QPushButton):
def __init__(self):
pass
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 python_inside_maya+***@googlegroups.com.
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 python_inside_maya+***@googlegroups.com.
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.