Skip to content

Instantly share code, notes, and snippets.

@PaulDebus
Created February 28, 2018 08:02
Show Gist options
  • Save PaulDebus/45c99ec86b7f5d95d83af9de8f78b70e to your computer and use it in GitHub Desktop.
Save PaulDebus/45c99ec86b7f5d95d83af9de8f78b70e to your computer and use it in GitHub Desktop.
Small pyqt test for not working alt-p
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