AnsweredAssumed Answered


Question asked by dstazic on May 12, 2015
Latest reply on May 27, 2015 by dstazic


I had posted this in Developers but it's been sitting there a couple of days with no response so I thought I'd try this space instead.




The answer is most probably glaring me in the face but I can't see it.


I needed to activate a Python tool dialog through a Addin button and GPToolDialog looks like the answer.


The following is the script, can't be much simpler.


import arcpy
import pythonaddins
class ButtonClass1(object):
    """Implementation for Addin_Test_addin.button (Button)"""
    def __init__(self):
        self.enabled = True
        self.checked = False
    def onClick(self):
        pythonaddins.GPToolDialog(r'C:\Users\stazicd\AppData\Roaming\ESRI\Desktop10.1\ArcToolbox\My Toolboxes\PVP Zoom.tbx','PVPZoom')

The button runs and after some time eventually zooms out to the full extent of the map document.


Don't be distracted by that zoom and think that my tool isn't working correctly. If I only have a  simple pythonaddins.MessageBox the same thing happens. It looks like the script isn't finding pythonaddins.


The button does work if I only have code in onClick that doesn't have any pythonaddins so the setup of the button is OK.


To check I ran the above GPToolDialog command in ArcMap using the Python command line window, things worked as they should.


Looks like I'm missing something in a set up somewhere. Any suggestions folks.





(Curtis Price formatted the code 5/15/2015)