I want to run python script. I don't know the name of toolbar in python script language : menu toolbar, browser panel toolbar, and label toolbar. The screenshots of the toolbars for which I don't know the python names of are:

enter image description here

enter image description here

enter image description here

To test the name of toolbar is true, I try to type in python script like this :




But, the toolbar is still be visible. So the name of these toolbar is false. So, what the name of these toolbar?


1 Answer 1


Based on the answer and comments on this post: Tool Bar visibility in PyQGIS, we can determine the name of these objects and set their visibility to False. If you go to the menubar and select Settings > Customization, you can see the types of objects used. In your case:

So, we can find all the names of objects which fall under each of those object types by using:

from PyQt4.QtGui import QToolBar, QDockWidget, QMenuBar

# Get list of all ToolBars
for x in iface.mainWindow().findChildren(QToolBar): 
    print x.objectName()

# Get list of all Dockwidgets
for x in iface.mainWindow().findChildren(QDockWidget): 
    print x.objectName()

# Get name of MenuBar
for x in iface.mainWindow().findChildren(QMenuBar): 
    print x.objectName()

Once we have determined the names of the objects you are interested in, we can hide them:

  • Menu Toolbar: iface.mainWindow().menuBar().setVisible(False)
  • Browser Panel: iface.mainWindow().findChild(QDockWidget,'Browser').setVisible(False)
  • Label Toolbar: iface.mainWindow().findChild(QToolBar,'mLabelToolBar').setVisible(False)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.