I have 3 Point shapefiles for 3 species that contains the accession points of each. The user needs to specify only one species at a time. I need to write a script tool for adding the selected Point layer. How can i used the radio buttons in this case.. Important for my thesis work..

import arcpy

mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd, "*")[0]
addLayer = arcpy.mapping.Layer(r"D:\Academic\M.E_thesis\data\acc_point.lyr")
arcpy.mapping.AddLayer(df, addLayer, "BOTTOM")

The script above is for adding just one layer.. In my case, the user needs to specify what species to be added to TOC.. So, i need 3 radio buttons. Else, a dropdown list that automaticaaly displays the names of 3 species.

  • 1
    You need to be a bit more specific. Could you post your script as it is now? And a few screenshots?
    – Martin
    Apr 18, 2013 at 7:38

5 Answers 5


As far as putting radio boxes in a Toolbox tool of your own, it's not possible, at least not at 10.0 (which is what I am running, so I cannot say for 10.1). In March of 2012 I emailed a contact at Esri on their Python team and he informed me that no, it was not possible to insert radio boxes. He told me:

The closest you’d get is with a multivalue, but that’s checkboxes so you’d have to do some insane validation logic to make it ‘work.’ I think you’re stuck with the dropdowns for lists of choices.

Like others have mentioned, go with checkboxes (booleans) or dropdown with a list.


I actually think what you're looking for was covered in Creating checkbox parameter in Python script tool for ArcGIS Desktop?

Basically you need to expose a boolean parameter within your script as the others suggest. The above link just builds onto what they said and provides a bit more guidance.


Perhaps you want to use an input parameter Data Type of Layer File, and set its MultiValue property to Yes. Your tool's dialog will then allow you to select multiple layer files and add them to a list.

Details: The Parameters tab of the Properties page of your script tool is where you specify the Data Type of your input parameters. You'll notice that clicking in the Data Type column for a parameter gives you a combobox of the available GP datatypes. And if you want to read more, see this PDF.

A boolean input parameter gets rendered as a check box in the tool dialog, so that's probably inconvenient.

In your case you specifically want to pick multiple layer files, so you could set your input parameter Data Type to Layer File, and MultiValue property to Yes.

And if you don't want to bother your user to type or browse to the layer files, but those paths are known ahead of time, you could set the parameter's Default property to be a semicolon-delimited list of catalog paths to the layer files "c:\temp\layerA.lyr;c:\temp\layerB.lyr", which will pre-populate the layer list shown in the tool's dialog, and the users could remove the ones they don't want to use?

the tool dialog will look like (nevermind the error my example doesn't point to actual data on my system so it fails validation):

tool dialog using layer files

Perhaps getting even closer to your original goal, you could use a parameter of type String instead of Layer File and provide a Default being a list of aliases "Layer A;Layer B;Layer C" in this way, and have your script do the work of translating each layer alias to its catalog path. The dialog looks like this:

tool dialog using layer aliases

blah blah somebody stop me.


The easiest way to do this to me is to define three script tool parameters of Boolean type for each of the shapefile since you have just three. So you will get checkbox for each shapefile instead of radiobutton. Something like:

ischecked1 = arcpy.GetParameterAsText(0)

if str(ischecked) == 'true':
    #code for processing shp1
else: #in this case, the check box value is 'false', user did not check the box
    #check if other checkboxes buttons are on/off
  • thanks Alex.. How can i get a dropdown list of the 3 species names.. I need to something like the "Editor" tool, which has "Start editing, Stop editing etc" in the dropdown list Apr 18, 2013 at 8:01
  • 3
    This sounds more like a pulldown menu rather than a dropdown list (which I would probably call a pick list like a domain gives you when editing a field value). Perhaps you can include a diagram showing what you are wanting to see on your Python Script Tool dialog, and the behaviour you are wanting from it
    – PolyGeo
    Apr 18, 2013 at 8:13

Try setting the input parameter as a filter - value list, when using the Add Script wizard, where you have the three species as a list of string values that become available as in a dropdown list, and the one chosen by the user is tested by your code to then add the corresponding layer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.