menubar pyqt

Solutions on MaxInterview for menubar pyqt by the best coders in the world

showing results for - "menubar pyqt"
Tess
19 Apr 2020
1menubar = self.menuBar() # create our menubar
2file = menubar.addMenu("&File") # create a file menu
3open = QAction("&Open", self) # create a QAction
4open.setShortcut("Ctrl+O") # set a shortcut for it
5file.addAction(open) # and add it to our menu
6
7# create another one and add it again to our menu
8save = QAction("&Save",self) 
9save.setShortcut("Ctrl+S")
10file.addAction(save)
11
12# and if you want to connect your QActions to your slots you can do it like:
13open.triggered.connect(lambda: self.yourfunction())