Alquimista Alquimista - 1 year ago 341
Python Question

how code a Image button in PyQt?

Im trying to do simple audio player, but I want use a image(icon) as a pushbutton.

Answer Source

I've seen that a lot of people have this problem and decided to write a proper example on how to fix it. You can find it here: An example on how to make QLabel clickable The solution in my post solves the problem by extending QLabel so that it emits the clicked() signal. The extended QLabel looks something like this:

class ExtendedQLabel(QLabel):

    def __init__(self, parent):
        QLabel.__init__(self, parent)

    def mouseReleaseEvent(self, ev):

I hope this helps!