-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added menubar, added parameter to remove redundancy in callbacks
- Loading branch information
1 parent
7ed4a55
commit 0dfca38
Showing
5 changed files
with
205 additions
and
101 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import functools | ||
import sys | ||
from PyQt5.QtWidgets import QMainWindow, QAction, qApp, QApplication | ||
|
||
|
||
class basicMenubar(QMainWindow): | ||
def __init__(self, *args, **kwargs): | ||
super().__init__(*args, **kwargs) | ||
|
||
self.initUI() | ||
|
||
def initUI(self): | ||
self.setGeometry(200, 200, 200, 200) | ||
|
||
exitAction = QAction('&Exit', self) | ||
exitAction.setShortcut('Ctrl+Q') | ||
exitAction.setStatusTip('Exit application') | ||
exitAction.triggered.connect(qApp.quit) | ||
|
||
umpumpenView = QAction('&Umpumpen', self) | ||
umpumpenView.setShortcut('Ctrl+A') | ||
umpumpenView.setStatusTip('Exit application') | ||
umpumpenView.triggered.connect(functools.partial(print, "Umpumpen")) | ||
|
||
dosierenView = QAction('&Dosieren', self) | ||
dosierenView.setShortcut('Ctrl+S') | ||
dosierenView.setStatusTip('Exit application') | ||
dosierenView.triggered.connect(functools.partial(print, "Dosieren")) | ||
|
||
fuellstandView = QAction('&Füllstand', self) | ||
fuellstandView.setShortcut('Ctrl+D') | ||
fuellstandView.setStatusTip('Exit application') | ||
fuellstandView.triggered.connect(functools.partial(print, "Füllstand")) | ||
|
||
durchflussView = QAction('&Durchfluss', self) | ||
durchflussView.setShortcut('Ctrl+F') | ||
durchflussView.setStatusTip('Exit application') | ||
durchflussView.triggered.connect(functools.partial(print, "Durchfluss")) | ||
|
||
self.statusBar() | ||
|
||
menubar = self.menuBar() | ||
menu = menubar.addMenu('&Menu') | ||
menu.addAction(exitAction) | ||
menu.addAction(umpumpenView) | ||
menu.addAction(dosierenView) | ||
menu.addAction(fuellstandView) | ||
menu.addAction(durchflussView) | ||
|
||
self.setWindowTitle('PyQt5 Basic Menubar') | ||
self.show() | ||
|
||
|
||
if __name__ == '__main__': | ||
|
||
app = QApplication(sys.argv) | ||
ex = basicMenubar() | ||
sys.exit(app.exec_()) |
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
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
Oops, something went wrong.