May 2019
Intermediate to advanced
542 pages
13h 37m
English
The application menu is a crucial feature for most applications, offering access to all the application's functionality in hierarchically organized drop-down menus.
We can create on easily using the QMainWindow.menuBar() method:
menubar = self.menuBar()
The menuBar() method returns a QMenuBar object, and as with statusBar(), this method will give us the window's existing menu if it exists, or simply create a new one if it doesn't.
By default, the menu is blank, but we can add submenus using the menu bar's addMenu() method, like so:
file_menu = menubar.addMenu('File') edit_menu = menubar.addMenu('Edit') help_menu = menubar.addMenu('Help')
addMenu() returns a QMenu object, which represents a drop-down submenu. ...
Read now
Unlock full access