Open topic with navigation
<viz>.choose
This command prompts the user to choose from a list of options
<viz>.choose( |
|
prompt |
choices |
selection = 0 |
) |
|
prompt
A string that will show up above the selection
choices
A list of strings that specify the possible choices
selection = 0
The initial selection. The default is 0, which is the first option in the list. 1 would be the second option in the list, and so on.
Remarks
This command halts all action in the script until the user has chosen an option. For this reason, it is primarily used to collect initialization information before the real-time rendering begins.
Return Value
The index of the option in the list that the user chose.
Example
choices = ['red','green','blue','yellow','orange','other']
favoriteColor = viz.choose('Choose your favorite color',choices)
print('You chose',choices[favoriteColor])
See also