Created
February 28, 2018 08:02
-
-
Save PaulDebus/45c99ec86b7f5d95d83af9de8f78b70e to your computer and use it in GitHub Desktop.
Small pyqt test for not working alt-p
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PyQt5 import QtGui, QtCore, QtWidgets | |
class Window(QtWidgets.QWidget): | |
def __init__(self): | |
QtWidgets.QWidget.__init__(self) | |
self.shortcut = QtWidgets.QShortcut(QtGui.QKeySequence(QtCore.Qt.ALT + QtCore.Qt.Key_O), | |
self) | |
self.shortcut.activated.connect(self.print_alt_o) | |
self.shortcut = QtWidgets.QShortcut(QtGui.QKeySequence(QtCore.Qt.ALT + QtCore.Qt.Key_P), | |
self) | |
self.shortcut.activated.connect(self.print_alt_p) | |
self.shortcut = QtWidgets.QShortcut(QtGui.QKeySequence(QtCore.Qt.CTRL + QtCore.Qt.Key_P), | |
self) | |
self.shortcut.activated.connect(self.print_ctrl) | |
def print_alt_p(self): | |
print("alt-p") | |
def print_alt_o(self): | |
print("alt-o") | |
def print_ctrl(self): | |
print("ctrl-p") | |
if __name__ == '__main__': | |
import sys | |
app = QtWidgets.QApplication(sys.argv) | |
window = Window() | |
window.show() | |
sys.exit(app.exec_()) | |
~ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment