Check out Kite (free AI Coding Assistant) → Link



Buy Me a Coffee? Your support is much appreciated!

PayPal Me: https://www.paypal.me/jiejenn/5
Venmo: @Jie-Jenn

Source Code:   

import sys      
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QVBoxLayout
from PyQt5.QtCore import Qt


class AppDemo(QWidget):
    def __init__(self):
        super().__init__()
        
        layout = QVBoxLayout()

        button = QPushButton('Click')
        button.clicked.connect(self.handleButton)
        layout.addWidget(button)

        self.setLayout(layout)

    def handleButton(self):
        modifiers = QApplication.keyboardModifiers()

        if modifiers == Qt.ShiftModifier:
            print('Shift+Click')
        elif modifiers == Qt.ControlModifier:
            print('Ctrl+Click')
        elif modifiers == (Qt.ShiftModifier | Qt.ControlModifier):
            print('Ctrl+Shift+Click')
        else:
            print('Mouse Click')


if __name__ == '__main__':
    app = QApplication(sys.argv)

    demo = AppDemo()
    demo.show()
    
    sys.exit(app.exec_())