I want to have a button in a toolbar which when clicked, zooms to the extent of the next selected polygon. I am not sure whether this tool has been developed yet (although i´m sure it has) and do not know whether it should be a python button, or tool class.
Following code creates a list of selected elements. I want to go to the next row after each mouse click.
mxd = arcpy.mapping.MapDocument('CURRENT')
df = arcpy.mapping.ListDataFrames(mxd, "Layers") 
Envelopes =  # store extents here
# find the selection set
SelLayer = arcpy.mapping.ListLayers(mxd,data_frame=df) # first layer
fidSet = arcpy.Describe(SelLayer).FIDSet
if len(fidSet) == 0:
# now cursor through it an get the geometries
# storing their extents into a list
with arcpy.da.SearchCursor(SelLayer,"SHAPE@") as SCur:
for feat in SCur:
# I'm going to assume polygon/polyline
Envelopes.append(feat.extent) # grab the envelope
df.extent = Envelopes # first extent
The code creates the list, but how can I use a button zoom to the next row extent?