Skip to content

Instantly share code, notes, and snippets.

@mgrady3
Created September 22, 2016 17:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mgrady3/8168da3869869ec11a281103014300c8 to your computer and use it in GitHub Desktop.
Save mgrady3/8168da3869869ec11a281103014300c8 to your computer and use it in GitHub Desktop.
PyQt5 Menubar test for OS X bug
import sys
from PyQt5 import QtWidgets
def main():
app = QtWidgets.QApplication(sys.argv)
window = QtWidgets.QWidget()
window.setWindowTitle("Test")
menu = QtWidgets.QMenuBar()
filemenu = menu.addMenu("File")
test = QtWidgets.QAction("test")
test.triggered.connect(test_print)
test.setShortcut("Ctrl+t")
filemenu.addAction(test)
window.show()
sys.exit(app.exec_())
def test_print():
print("Test ... ")
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment