import arcpy import pythonaddins class ComboBoxClass1(object): """Implementation for Project Map_addin.combobox (ComboBox)""" def __init__(self): self.items = ["Project 1", "Project 2", "Project 3", "Project 4"] self.editable = False self.enabled = True self.dropdownWidth = 'WWWWWWWWW' self.width = 'WWWWWWWWWWWW' self.refresh() def onSelChange(self, selection): pass def onEditChange(self, text): pass def onFocus(self, focused): pass def onEnter(self): pass def refresh(self): pass
Thanks for the quick responses. AMJSkinn3: All Arc applications were closed when the add-in was installed. To make sure I uninstalled the add in, recreated the project folder, compiled, and re-installed the add-in. Also, neither the python window nor the results window have any errors to report. When I added the toolbar to ArcMap, the combo box says "[Missing]". For a quick explanation to what I'm trying to accomplish.. I'd like to select a project name from the combo box. The project name selected will direct a python script to grab specific layers on file with which it will build a project map with correct Data Frame name and Spatial Reference.I'm trying to solve this issue with the simplest example possible to make sure it is do-able.
self.items = ["Project 1", "Project 2", "Project 3", "Project 4"]
class ListLayers(object): """Implementation for NEZ_EDITS_addin.list_layers (ComboBox)""" def __init__(self): self.editable = True self.enabled = True self.dropdownWidth = 'WWWWWWWWWWWW' self.width = 'WWWWWWWWWWW' def onSelChange(self, selection): global l l=arcpy.mapping.ListLayers(self.mxd, selection)[0] arcpy.RefreshActiveView() def onFocus(self, focused): if focused: self.mxd = arcpy.mapping.MapDocument('current') layers = arcpy.mapping.ListLayers(self.mxd) self.items = [] for layer in layers: self.items.append(layer.name) def onEnter(self): pass def refresh(self): pass
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.