4

Im able to implement zoom in and zoom out functionality as described in the PyQGIS developer cookbook using a tool bar. I would like to have buttons that display above my map canvas layer and have the same functionality as oppose to using a toolbar

1

Using PyQGIS, you're able to manipulate pyqgis calls and make plugins. You cannot add content to the QGIS application. This would be done in CPP. You can take a look at the following pull request, which add a button in the subform.

https://github.com/qgis/QGIS/pull/1682/commits

What you may want is in fact to add a toolbar or a menu in the QGIS application using PyQGIS in the form of a plugin.

Take a look at plugin building: http://www.qgisworkshop.org/html/workshop/plugins_tutorial.html

and you will add you're toolbar with the following line to the QGIS main window:

self.toolbar = self.iface.addToolBar('My toolbar')
  • @Marcus is not asking about how to add content to QGIS, but to a standalone application built with PyQGIS. Moreover, he has told us he already had success with adding toolbars and would like a different approach. – Germán Carrillo Jan 19 '15 at 12:44
  • As he must have a ui file (isn't it ?), a button can simply be added there. – GilliM Jan 19 '15 at 14:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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