Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I want to create a button and add it to the QGIS toolbox or alternatively create my own toolbox and add the button here.

A plugin should be started when the user clicks the button.

share|improve this question

1 Answer 1

You can add icons to the toolbar or menus. There is no toolbox. For more info check the pyqgis Cookbook http://www.qgis.org/pyqgis-cookbook/plugins.html

def initGui(self):
    # create action that will start plugin configuration
    self.action = QAction(QIcon(":/plugins/testplug/icon.png"), "Test plugin", self.iface.mainWindow())
    self.action.setWhatsThis("Configuration for test plugin")
    self.action.setStatusTip("This is status tip")
    QObject.connect(self.action, SIGNAL("triggered()"), self.run)

    # add toolbar button and menu item
    self.iface.addToolBarIcon(self.action)
    self.iface.addPluginToMenu("&Test plugins", self.action)
share|improve this answer
    
thank you very much! –  Cathrin Jun 21 '12 at 9:17
1  
Then why don't you accept the answer –  Stat-R Jul 26 '12 at 3:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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