<div dir="ltr">hi ,<br><br>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<br>
<br>from PyQt4 import QtGui, QtCore<br>from PyQt4.QtCore import pyqtSignal<br>import os,sys<br><br>class HoverButton(QtGui.QToolButton):<br> def enterEvent(self,event):<br> print("Enter")<br> button.setStyleSheet("background-color:#45b545;")<br>
<br> def leaveEvent(self,event):<br> button.setStyleSheet("background-color:yellow;")<br> print("Leave")<br>app = QtGui.QApplication(sys.argv)<br>widget = QtGui.QWidget()<br>button = QtGui.QToolButton(widget)<br>
button.setMouseTracking(True)<br>buttonss = HoverButton(button)<br>button.setIconSize(QtCore.QSize(200,200))<br>widget.show()<br>sys.exit(app.exec_())<br><br><br></div>