AnsweredAssumed Answered

Parameter as Dropdown/Combobox in Python toolbox

Question asked by carrierkh on Sep 5, 2014
Latest reply on Sep 9, 2014 by ANohe-esristaff

I originally wrote this as a python add-in but I could really use some type of GUI or user interface. Since Tkinter and wx are not supported nor stable when used inside ArcMap I am trying to either build the entire functionality in a python toolbox or python add-in although it looks like I will have to use a combination of both.

 

All I want is to be able to do is loop through a directory and return a list of folders within that directory. These folders all contain different layer files(*.lyr)

When the user would choose a folder, a list of values would be presented to the user in something like a listbox or pick list. After user selects layer it adds the layer to the TOC.

 

How can I get the code below to return a list in a python toolbox and present it to the end user as a drop down or combobox.

 

I would have thought there would have been some type of parameter to have a list presented to the end user but I cannot seem to find one that will work for this scenario.

 

wrkspc = '//someserver/GIS/Layers/'

folders = []

for dirpath, dirnames, filenames in arcpy.da.Walk(wrkspc,topdown=True):

     if '.' not in str(dirpath):

          folder = str(os.path.basename(dirpath))

          folders.append(folder)

return folders

Outcomes