Jskinn3 brings up some good points about installing combo boxes. However, if this is how your code is currently set up your drop down will be populated with the values that you identified in self.itemsself.items = ["Project 1", "Project 2", "Project 3", "Project 4"]
here is a snippet from an addin tool bar that I created. 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
This should allow you to populate your combo box with the TOC from your mxd and when selection is made the layer selected becomes a global variable that can be used in any of the other buttons on my toolbar.