How to create a menu bar on OSX with PySide2?
NickName:Mike Conigliaro Ask DateTime:2020-02-19T07:11:52

How to create a menu bar on OSX with PySide2?

I'm looking at the Data Visualization Tool Tutorial on the QT website where they have an example of creating a menu bar inside a QMainWindow:

self.menu = self.menuBar()
self.file_menu = self.menu.addMenu("File")

This doesn't work for me on OSX 10.13.6. I've also tried using QMenuBar to create my own menu bar rather than using the default one that comes with a QMainWindow:

menu_bar = QMenuBar()
menu_bar.addMenu('File')
self.setMenuBar(menu_bar)

This also has no effect. I never see the "File" option in the menu bar of my app. I just get a generic menu bar with a single "python" option.

Copyright Notice:Content Author:「Mike Conigliaro」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/60290777/how-to-create-a-menu-bar-on-osx-with-pyside2

More about “How to create a menu bar on OSX with PySide2?” related questions