3

I am trying to use a script tool in python add-in wizard to make a toolbar which will have button options. The script tool is working fine in the toolbox and I am using them in arcgis 10.2.2. The script tool I am using doesn't interact with the map. It takes in some input and run some geoprocessing. I want to add the script tool in a toolbar so that I can interact with the output of the geoprocessing. When I added it to the toolbar it does show up in the toolbar but doesn't run the script tool when clicked.

Can anyone suggest how I can use scripted tool in python add-in wizard?

2

Once you've created the toolbar with the button tool via the python add-in wizard, you can edit the python script in the Install folder and use the pythonaddins.GPToolDialog in the buttons onClick method.

Example from the help:

import arcpy
import pythonaddins

class OpenGPTool(object):
    def __init__(self):
        self.enabled = True
        self.checked = False
    def onClick(self):
        pythonaddins.GPToolDialog(r'C:\MyTools\WaterStudy.tbx', 'GroundWaterYield')

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.