Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 [PyQt] `QPushButton` without mouse click animation

I'm looking for a way to disable the left click animation of a QPushButton, but animation and left mouse click seems to be tightly connected within Qt.

How to disable click animation for left mouse clicks?
Perhaps you could use a QLabel instead and implement something similar to this:

Here I translated it for you:

import sys
from PyQt5 import QtCore, QtWidgets

class ClickableLabel(QtWidgets.QLabel):
    clicked = QtCore.pyqtSignal()

    def __init__(self, parent):

    def mouseReleaseEvent(self, event):
        if event.button () == QtCore.Qt.LeftButton:

class Main(QtWidgets.QMainWindow):
    def __init__(self, parent):
        self.ui = QtWidgets.QWidget(self)
        self.ui.label = ClickableLabel(self)
        self.ui.layout = QtWidgets.QVBoxLayout()

if __name__== '__main__':
    app = QtWidgets.QApplication(sys.argv)
    gui = Main(app)
Many thanks for porting the code from C++ to Python.

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  [Tkinter] Tkinter window pop up again when i click button Orimura_Sandy 1 231 May-12-2019, 08:17 PM
Last Post: joe_momma
  [Tkinter] Not getting entry values on button click & treeview not updating ? swanysto 4 370 May-10-2019, 04:16 PM
Last Post: swanysto
  Simple Button click on image file to create action? jpezz 4 258 Mar-27-2019, 10:08 PM
Last Post: jpezz
  QTabBar Indexing is wrong for right mouse click xenas 2 351 Jan-04-2019, 10:08 PM
Last Post: xenas
  [PyQt] PyQt4 handle dynamic checkbox click littleGreenDude 1 692 Dec-27-2018, 09:17 PM
Last Post: littleGreenDude
  right mouse button click with PyQt5 brecht83 4 2,045 Nov-09-2018, 02:55 PM
Last Post: brecht83
  [Tkinter] loop function when called from tkinter button click WantedStarling 5 1,409 Jul-13-2018, 06:12 PM
Last Post: nilamo
  [PyQt] QSlider jump to mouse click position MegasXLR 2 1,753 May-26-2018, 08:55 AM
Last Post: MegasXLR
  (pyQt/pySide)setStyleSheet(border…) makes QPushButton not clickable in Maya vladlenPy 0 1,192 Apr-15-2018, 12:41 PM
Last Post: vladlenPy
  Tkinter touch screen button click ashtona 2 2,207 Apr-13-2018, 11:46 AM
Last Post: buran

Forum Jump:

Users browsing this thread: 1 Guest(s)