August 2024
Intermediate to advanced
256 pages
5h 34m
English
You can add menus to the window. First create the menu bar.
menu_bar = window.menuBar()
Create the actual menu to appear on the bar. You can create one of these for each menu that appears along the menu bar
file_menu = menu_bar.addMenu(“File”)
Create menu items for each menu created above
exit_action = QAction(“Exit”, window)
exit_action.triggered.connect(window.close)
Add the menu item to the menu
file_menu.addAction(exit_action)
Have a look at pyqtmenu.py in the Ch09 folder
Read now
Unlock full access