How can I check if a keyboard modifier is pressed (Shift, Ctrl, or Alt)?

It looks like all you need to do is check the keyboardModifiers in your button handler, and select a different action as appropriate. The various modifiers can be OR’d together in order to check for multi-key combinations: PyQt5: import sys from PyQt5 import QtCore, QtWidgets class Window(QtWidgets.QWidget): def __init__(self): super().__init__() self.button = QtWidgets.QPushButton(‘Test’) self.button.clicked.connect(self.handleButton) layout … Read more