I am coding an addin to allow me to use 3 comboboxes to select specific regions within a state. Once these are all selected in the comboboxes I need a final button to zoom to the selected area, indicated by the comboboxes. I am not sure how to get the selections from the three comboboxes to all be passed on to the zoom button so that it will zoom to the correct selected region.
Below is my code:
import arcpy
import pythonaddins
class SectionComboBoxClass35(object):
"""Implementation for SEC_TWN_RNG_2_addin.combobox (ComboBox)"""
def __init__(self):
self.items = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10" ,"11", "12", "13", "14",
"15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31",
"32", "33", "34", "35", "36"]
self.editable = True
self.enabled = True
self.dropdownWidth = 'WWWWWW'
self.width = 'WWWWWW'
def onSelChange(self, selection):
pass
def onEditChange(self, text):
pass
def onFocus(self, focused):
pass
def onEnter(self):
pass
def refresh(self):
pass
class TownshipComboBoxClass36(object):
"""Implementation for SEC_TWN_RNG_2_addin.combobox_1 (ComboBox)"""
def __init__(self):
self.items = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14",
"15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30",
"31","32", "32", "33", "34", "35"]
self.editable = True
self.enabled = True
self.dropdownWidth = 'WWWWWW'
self.width = 'WWWWWW'
def onSelChange(self, selection):
pass
def onEditChange(self, text):
pass
def onFocus(self, focused):
pass
def onEnter(self):
pass
def refresh(self):
pass
class TownshipDirectionComboBoxClass37(object):
"""Implementation for SEC_TWN_RNG_2_addin.combobox_2 (ComboBox)"""
def __init__(self):
self.items = ["N", "S", "E", "W"]
self.editable = True
self.enabled = True
self.dropdownWidth = 'WWWWWW'
self.width = 'WWWWWW'
def onSelChange(self, selection):
pass
def onEditChange(self, text):
pass
def onFocus(self, focused):
pass
def onEnter(self):
pass
def refresh(self):
pass
class RangeComboBoxClass38(object):
"""Implementation for SEC_TWN_RNG_2_addin.combobox_3 (ComboBox)"""
def __init__(self):
self.items = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14",
"15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30",
"31","32", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45"]
self.editable = True
self.enabled = True
self.dropdownWidth = 'WWWWWW'
self.width = 'WWWWWW'
def onSelChange(self, selection):
pass
def onEditChange(self, text):
pass
def onFocus(self, focused):
pass
def onEnter(self):
pass
def refresh(self):
pass
class RangeDirectionComboBoxClass39(object):
"""Implementation for SEC_TWN_RNG_2_addin.combobox_4 (ComboBox)"""
def __init__(self):
self.items = ["N", "S", "E", "W"]
self.editable = True
self.enabled = True
self.dropdownWidth = 'WWWWWW'
self.width = 'WWWWWW'
def onSelChange(self, selection):
pass
def onEditChange(self, text):
pass
def onFocus(self, focused):
pass
def onEnter(self):
pass
def refresh(self):
pass
class ZoomButtonClass40(object):
def onClick(self):
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd)[0]
addLayer = arcpy.mapping.Layer(r'T:\Software\ESRI-GIS\toolbars\sec-twn-rng\KDAGISEDITOR.plss.lyr')
arcpy.mapping.AddLayer(df, addLayer, "AUTO_ARRANGE")
"""Implementation for Zoom.button (Button)"""
def __init__(self):
self.enabled = True
self.checked = False
def onClick(self):
pass
# 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()