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
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register LoginAdvertisement