DEV Community

Dr. Azad Rasul
Dr. Azad Rasul

Posted on

23- Modifying Toolbar Visibility in QGIS Using PyQGIS

Learn how to customize the appearance of QGIS by changing the visibility of its toolbars with PyQGIS. In this tutorial, you will discover how to use the setVisible() method to show or hide specific toolbars such as Help, Vector, and Raster. With these simple lines of code, you can tailor QGIS to your needs and preferences.

  • To hide the Help toolbar in QGIS, use the following line of code:
iface.helpToolBar().setVisible(False)
Enter fullscreen mode Exit fullscreen mode
  • To show the Help toolbar in QGIS, use the following line of code:
iface.helpToolBar().setVisible(True)
Enter fullscreen mode Exit fullscreen mode
  • To hide the vector toolbar in QGIS, use the following line of code:
iface.vectorToolBar().setVisible(False)
Enter fullscreen mode Exit fullscreen mode
  • To show the vector toolbar in QGIS, use the following line of code:
iface.vectorToolBar().setVisible(True)
Enter fullscreen mode Exit fullscreen mode
  • To hide the raster toolbar in QGIS, use the following line of code:
iface.rasterToolBar().setVisible(False)
Enter fullscreen mode Exit fullscreen mode
  • To show the raster toolbar in QGIS, use the following line of code:
iface.rasterToolBar().setVisible(True)
Enter fullscreen mode Exit fullscreen mode

In conclusion, PyQGIS provides a simple and efficient way to customize the appearance of QGIS by changing the visibility of its toolbars. By using the setVisible() method, you can easily show or hide specific toolbars such as Help, Vector, and Raster, tailoring QGIS to your needs and preferences. With these lines of code, you can improve your workflow and make QGIS more user-friendly.

If you like the content, please SUBSCRIBE to my channel for the future content

Top comments (0)