I'm following a tutorial here: http://resources.arcgis.com/en/help/main/10.1/index.html#/button/014p0000001z000000/
I have added the code to the .py file and installed the add-in using the makeaddin.py file and Test001.esriaddin file yet when I press the button in ArcMap, nothing happens. It's supposed to zoom to the selected features. I have ArcMap 10.2 and indicated so in the Python Add-In Wizard provided by ESRI. Thanks in advance for any help you can offer in this matter. Here is the code:
import arcpy
import pythonaddins
class ZoomToSelectedFeatures(object):
"""Implementation for Test001_addin.btn1 (Button)"""
def __init__(self):
self.enabled = True
self.checked = False
# Implementation of OnClick method of Button's class
def onClick(self):
# Get the current map document and the first data frame.
mxd = arcpy.mapping.MapDocument('current')
df = arcpy.mapping.ListDataFrames(mxd)[0]
# Call the zoomToSelectedFeatures() method of the data frame class
df.zoomToSelectedFeatures()
Wow! it won't let me post images unless I have 10 reputation...