Skip to content

Instantly share code, notes, and snippets.

@saleph
Created August 26, 2015 12:46
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 saleph/4e62dde92861b1cfc287 to your computer and use it in GitHub Desktop.
Save saleph/4e62dde92861b1cfc287 to your computer and use it in GitHub Desktop.
[qt5] menubar + tip in statusbar
__author__ = 'tom'
import sys
from PyQt5.QtWidgets import QMainWindow, QAction, qApp, QApplication
from PyQt5.QtGui import QIcon
class Example(QMainWindow):
def __init__(self):
super().__init__()
self.init_ui()
def init_ui(self):
exit_action = QAction(QIcon('quit.png'), '&Exit', self)
exit_action.setShortcut('Ctrl+Q')
exit_action.setStatusTip('Exit application')
exit_action.triggered.connect(qApp.quit)
self.statusBar()
menu_bar = self.menuBar()
file_menu = menu_bar.addMenu('&File')
file_menu.addAction(exit_action)
self.setGeometry(300, 300, 300, 200)
self.setWindowTitle('Menu bar')
self.show()
if __name__ == "__main__":
app = QApplication(sys.argv)
ex = Example()
sys.exit(app.exec_())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment