Inputbox prompts by variable
-
I have a problem once again .
This code works well:
prompts = ['What is your Name?', 'What is your Age?', 'Gender'] defaults = ['Enter name', '', 'Male'] list = ['', '', 'Male|Female'] input = UI.inputbox prompts, defaults, list, 'Tell me about yourself.'Now I want to give the information by variable.
For example for 'prompts':p = "'"What is your Name?"'" + "," + "'"What is your Age?"'" + "," + "'"Gender"'" prompts = [p] ...But that don“t works!
What is my mistake?
Is there another way to solve the problem?
Or is that not possible? -
Here are three lines out of one of my programs:
` prompts=["Help options: ","Import unit: ","Select origin: ","Polylines: ","Materials: "]
enums=[update_this, units_list, model_selection, convert_selection, import_texture]
results=inputbox prompts, a_values, enums, my_file_name+" Options"`
I have never tried what you seem to be attempting.
-
In the first example,
promptsis an Array of Strings, which is the correct form.In the second,
pjust a String; so when you write prompts = [p], y0u get an Array containing a single String.p = [] p << "What is your Name?" << "What is your Age?" << "Gender" prompts = pDo not use
pas a variable. Although it does work,pis a shortcut for the.inspectmethod.
p promptsis the same asputs prompts.inspect
Advertisement