Get the App
SLTechnology News&Howtos  ›  Development  › 

How to create menu Bar by PyQt in python

Shulou Source: shulou.com Published: 2022-06-03 17:34:06 11月13日 Update

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!

Tags: Menus objects methods content applications programs articles applications values interests variables examples guys buddies more knowledge examples industries information information channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei NVidia OPPO Reno vpn MySQL