Qu

ui_select

Builtin index · Plotting

result = ui_select(label, options, [default], [id=])

Input: label, options, default, id · Output: result

What it is

Declares a dropdown, labeled label (string), choosing among options (a List of strings — or of any values, displayed via their string form). default (positional, default options's first entry) and id= (string) as above.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
result = ui_select(label, options, [default], [id=])
label string or ListDeclares a dropdown, labeled label (string), choosing among options (a List of strings — or of any values, displayed via their string form).
options string or ListDeclares a dropdown, labeled label (string), choosing among options (a List of strings — or of any values, displayed via their string form).
default string, optionaldefault (positional, default options's first entry) and id= (string) as above.
id string, optionaldefault (positional, default options's first entry) and id= (string) as above.
result string
Returns the current (or default) choice as a string.

Examples

From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.

freq = ui_slider("freq", 1, 20, 5)
gain = ui_number("gain", 1.0)
mode = ui_select("mode", ["fast", "slow"])
enabled = ui_checkbox("enabled", true)
pressed = ui_button("reset")
label = ui_text("label", "wave")
print(freq)
print(gain)
print(mode)
print(enabled)
print(pressed)
print(label)
output
5
1
fast
true
false
wave

from plotting

How it works

ui_select(label, options, [default], [id=]) -- options is a list/vector of choices, so a script can build them at runtime.

From the note above this builtin in the interpreter, where the reasoning was written down as it was built.