[Tutor] looping through object names

Pijus Virketis virketis@fas.harvard.edu
Tue, 24 Apr 2001 18:49:16 -0400


I am writing a Tk GUI, and want to loop through some string names, in order
to assign them as StringVars(). Thus:

list = [name, wage, wage_to_date]
var_list = []
for i in list:
	i = stringVar()
	var_list.append(i)

Except that this raises an error: I cannot store previously unnasigned
object names in a list like that. What would be an alternative method of
accomplishing this task? Perhaps storing them in a list as strings, and
them somehow extracting and using them?

Thanks for your help!

Pijus
----------------------------------------------------------------------------
-------------------
Please have a look at my weblog at www.fas.harvard.edu/~virketis.