Letting user choose from 2 options for QGIS Processing script input parameter?
If you are not limited to QGIS v2.8 (your screenshot points to v2.8 documentation), you can install a newer version. For example, in QGIS v2.14 you have a selection
parameter type available (see the docs):
You can use it in this way in the header of the script, separating options with a semicolon:
##Units=selection Millimeter;Centimeter;Meter
And later in the script you can get the chosen value in this way:
if Units == 0:
# User chose millimeter
elif Units == 1:
# User chose centimeter
elif Units == 2:
# User chose meter
For reference, here you have an example script.
Germán Carrillo's answer is the most convenient. A possible alternative (if you're stuck with QGIS 2.8) could be to:
Use a string which allows the user to enter the units they want to use:
##units=string mm if units == 'mm': # Do something elif units == 'cm': # Do something elif units == 'm': # Do something
Or use three boolean checkboxes:
##Millimeter=boolean ##Centimeter=boolean ##Meter=boolean if Millimeter == True: # Do something elif Centimeter == True: # Do something elif Meter == True: # Do something