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:
To test the name of toolbar is true, I try to type in python script like this :
iface.menuToolBar().setVisible(False)
iface.browserpanelToolBar().setVisible(False)
iface.labelToolBar().setVisible(False)
But, the toolbar is still be visible. So the name of these toolbar is false. So, what the name of these toolbar?
Best Answer
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 selectSettings > 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:
Once we have determined the names of the objects you are interested in, we can hide them:
iface.mainWindow().menuBar().setVisible(False)
iface.mainWindow().findChild(QDockWidget,'Browser').setVisible(False)
iface.mainWindow().findChild(QToolBar,'mLabelToolBar').setVisible(False)