hi ,

I want to do hover i saw an example and then write a script which will be
use as i made program i am facing one problem that hover only occur if u
putt mouse on the left corner of button i want that it will happen for all
the button that if i move cursor on button then it should change. here is
my code

from PyQt4 import QtGui, QtCore
from PyQt4.QtCore import pyqtSignal
import os,sys

class HoverButton(QtGui.QToolButton):
    def enterEvent(self,event):
        print("Enter")
        button.setStyleSheet("background-color:#45b545;")

    def leaveEvent(self,event):
        button.setStyleSheet("background-color:yellow;")
        print("Leave")
app = QtGui.QApplication(sys.argv)
widget = QtGui.QWidget()
button = QtGui.QToolButton(widget)
button.setMouseTracking(True)
buttonss =  HoverButton(button)
button.setIconSize(QtCore.QSize(200,200))
widget.show()
sys.exit(app.exec_())
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to