Having a small brain fart here… I want to be able to choose from a list of options. I have this in my code snippets:
import Rhino
def CommandLineOptions(prompt,msg,choices,ini):
go = Rhino.Input.Custom.GetOption()
go.SetCommandPrompt(prompt)
lstOption0 = go.AddOptionList(msg,choices,ini)
go.AcceptNothing(True)
index=ini
while True:
get_rc = go.Get()
if go.CommandResult()== Rhino.Commands.Result.Cancel:
return
elif go.CommandResult()== Rhino.Commands.Result.Nothing:
break
elif get_rc==Rhino.Input.GetResult.Option:
if go.OptionIndex()==lstOption0:
index = go.Option().CurrentListOptionIndex
continue
break
return index
#Test
prompt="These are your options:"
msg="Option"
ini=0
choices=["A","B","C","D","E"]
opt=CommandLineOptions(prompt,msg,choices,ini)
if opt is not None: print "You chose option {}".format(choices[opt])
This works fine, but when I run the script I am first presented with this:
What I would like to see first is this (what I get when I click on ‘Option=A’):
I don’t remember how to do this…
Thanks, --Mitch