Advertisement
Guest User

Untitled

a guest
Mar 25th, 2017
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. import sys
  2. from PyQt5.QtWidgets import QMainWindow, QAction, qApp, QApplication
  3. from PyQt5.QtGui import QIcon
  4.  
  5.  
  6. class Example(QMainWindow):
  7. def __init__(self):
  8. super().__init__()
  9.  
  10. self.initUI()
  11.  
  12. def initUI(self):
  13. exitAction = QAction(QIcon('exit.png'), '&Exit', self)
  14. exitAction.setShortcut('Ctrl+Q')
  15. exitAction.setStatusTip('Exit application')
  16. exitAction.triggered.connect(qApp.quit)
  17.  
  18. self.statusBar()
  19.  
  20. menubar = self.menuBar()
  21. fileMenu = menubar.addMenu('&File')
  22. fileMenu.addAction(exitAction)
  23.  
  24. self.setGeometry(300, 300, 300, 200)
  25. self.setWindowTitle('Menubar')
  26. self.show()
  27.  
  28.  
  29. if __name__ == '__main__':
  30. app = QApplication(sys.argv)
  31. ex = Example()
  32. sys.exit(app.exec_())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement