Created
July 24, 2016 19:33
-
-
Save sarim/eb20d58453200193fa55bd9d099245fb to your computer and use it in GitHub Desktop.
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
import sys | |
from PyQt5.QtWidgets import QMainWindow, QAction, qApp, QApplication, QMenuBar, QMenu | |
from PyQt5.QtGui import QIcon | |
class Example(QMainWindow): | |
def __init__(self): | |
super().__init__() | |
self.initUI() | |
def initUI(self): | |
exitAction = QAction(self) | |
exitAction.setText("Close this shit") | |
exitAction.setShortcut('Ctrl+Q') | |
exitAction.setStatusTip('Exit application') | |
exitAction.triggered.connect(qApp.quit) | |
self.statusBar() | |
menubar = self.menuBar() | |
fileMenu = QMenu(menubar) | |
fileMenu.setTitle('&File') | |
fileMenu.addAction(exitAction) | |
menubar.addAction(fileMenu.menuAction()) | |
self.setGeometry(300, 300, 300, 200) | |
self.setWindowTitle('Menubar') | |
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