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,
prompts
is an Array of Strings, which is the correct form.In the second,
p
just 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 = p
Do not use
p
as a variable. Although it does work,p
is a shortcut for the.inspect
method.
p prompts
is the same asputs prompts.inspect
Advertisement