how do i make the pushbutton icon in pyqt5 change its color dependent on the button being pressed

I believe the problem is following:

icon.addPixmap(QPixmap('./symbols/Example.png'), QIcon.Normal)
icon.addPixmap(QPixmap('./symbols/Example.png'), QIcon.Disabled)

You add same icon for both states, change one of them and it should work.

I am not fully sure how qt works now, didn’t work with it few years, but maybe you need to add listener for mouse events as well, an example can be found in this thread

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top