I have try the code in Finding name of QGIS toolbar in Python? and Name of children of toolbar in QGIS python and how to disable? to show the children name of menuBar. But, get error. The children name of menuBar are : Project, Edit, View, Layer, Settings, Plugins, Vector, Raster, Database, Web, Processing, and Help.
I have input the code :
from PyQt4.QtGui import QToolBar, QDockWidget, QMenuBar
for x in iface.mainWindow().findChildren(QMenuBar):
print x.objectName()
until here, it is work. The output is menubar. When I type the code :
for icon in iface.menubar().actions():
print icon.objectName()
It gives error : AttributeError: 'QgisInterface' object has no attribute 'menubar'.
To test the name is true, I want to remove many of children name. For example, I want to remove Edit, View, Layer, and Settings. So, how the code in python?