Here some code example...Its just some GP Script tool dialog to open on one butten, some print command on another and the exmaple fishnet tool taken from arcGIS helpfile...I also realised by using the makefile the images are not implemented so the addin only has 2KB and in beginning before populating with futher code it was something around 50kbimport arcpy
import pythonaddins
class ButtonClass1(object):
"""Implementation for TirolerV02_addin.btn1 (Button)"""
def __init__(self):
self.enabled = True
self.checked = False
def onClick(self):
# Starts Hailtool Dialog
print "Hailtool started"
pythonaddins.GPToolDialog("C:\\BW_Workspace\\Toolbox_BW_V02\\Toolbox_BW.tbx", "HagelSchadensableitung")
class ButtonClass2(object):
"""Implementation for TirolerV02_addin.btn2 (Button)"""
def __init__(self):
self.enabled = True
self.checked = False
def onClick(self):
print "hi"
pass
class ToolClass1(object):
"""Implementation for TirolerV02_addin.tool1 (Tool)"""
def __init__(self):
self.enabled = True
self.cursors = 3
self.shape = 'Rectangle'
def onRectangle(self, rectangle_geometry):
"""Occurs when the rectangle is drawn and the mouse button is released.
The rectangle is a extent object."""
extent = rectangle_geometry
# Create a fishnet with 10 rows and 10 columns.
if arcpy.Exists(r'in_memory\fishnet'):
arcpy.Delete_management(r'in_memory\fishnet')
fishnet = arcpy.CreateFishnet_management(r'in_memory\fishnet',
'%f %f' %(extent.XMin, extent.YMin),
'%f %f' %(extent.XMin, extent.YMax),
0, 0, 10, 10,
'%f %f' %(extent.XMax, extent.YMax),'NO_LABELS',
'%f %f %f %f' %(extent.XMin, extent.YMin, extent.XMax, extent.YMax), 'POLYGON')
arcpy.RefreshActiveView()
return fishnet