Increment Variable Name

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Fri Jan 25 15:00:02 EST 2008


En Wed, 23 Jan 2008 23:09:36 -0200, David Brochu <brochu121 at gmail.com>  
escribió:

> Basically what I am trying to do is pass each value from a list to
> the following line of code (where XXX is where I need to pass each
> value of the list
>
> tests = easygui.multchoicebox(message="Pick the test(s) you would
> like to run from the list below."
> 	, title="Validation Tests"
> 	,choices=[XXX])
>
> If i were to manually pass values to this line it would appear like :
> tests = easygui.multchoicebox(message="Pick the test(s) you would
> like to run from the list below."
> 	, title="Validation Tests"
> 	,choices=["Test 1","Test 2", "Test 3"])
>
> When I actually pass the list to the line of code, it works, however
> it doesn't really split the list by element. The desired output of
> this line of code would be a GUi that included a list consisting of
> each element from the passed list. Right now I can only get it to
> consist of a single element that contains every part of the list.

You should have posted this in the first place! No answer to your previous  
specific question would have helped you in this case.
See http://catb.org/~esr/faqs/smart-questions.html#goal

Ok, you have a list containing all the possible choices. It doesn't matter  
how did you build that list. Then, just pass *that* *list* as the choices  
parameter to the function. By example:

all_tests = ["Test 1","Test 2", "Test 3"]
tests = easygui.multchoicebox(message="Pick the test(s) you would
like to run from the list below.", title="Validation Tests",  
choices=all_tests)

(If you use [items] you are building a new list with a single element  
which itself is the list of choices, and that's not what multchoicebox  
expects).

-- 
Gabriel Genellina




More information about the Python-list mailing list