How to create menu Bar by PyQt in python
This article mainly introduces how to create the menu bar in PyQt in python. It is very detailed and has certain reference value. Friends who are interested must finish reading it.
QMainWindow provides empty QMenuBar objects by default. This method returns an empty menu bar. The parent of this menu bar will be the main window object.
1. Return to the application and add the Window method to the definition. To access this menu bar, you need to call the object in .menuBar ().
2. The menuBar variable will contain an empty menu bar, which will be the menu bar of the main window.
Example
Return to your sample application and add the following method Window to your definition:
Class Window (QMainWindow): # Snip... Def _ createMenuBar (self): menuBar = self.menuBar () these are all the contents of the article "how to create a menu bar in PyQt in python". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!