qaction in pyqt5 code example
Example 1: menubar pyqt
menubar = self.menuBar()
file = menubar.addMenu("&File")
open = QAction("&Open", self)
open.setShortcut("Ctrl+O")
file.addAction(open)
save = QAction("&Save",self)
save.setShortcut("Ctrl+S")
file.addAction(save)
open.triggered.connect(lambda: self.yourfunction())
Example 2: how to create a hekp menu pyqt5
mainMenu = self.menuBar()fileMenu = mainMenu.addMenu('File')editMenu = mainMenu.addMenu('Edit')viewMenu = mainMenu.addMenu('View')searchMenu = mainMenu.addMenu('Search')toolsMenu = mainMenu.addMenu('Tools')helpMenu = mainMenu.addMenu('Help')