array of Tkinter variables?

Jo Schambach jschamba at
Tue Nov 1 23:04:08 CET 2005

I want to build an array of entry widgets in python with Tkinter that
all have similar textvariables. I was hoping that I could use an array
of StringVar variables to attach to these widgets, so that I can loop
through the widget creation. But my simple minded approach failed:

        for i in range(32):
            self.dllAdjust[i] = StringVar()

gives me the following error:

  File "./", line 787, in setDefaultVals
    self.dllAdjust[i] = StringVar()
AttributeError: Configurator instance has no attribute 'dllAdjust'

("Configurator" is the class in which this code fragment appears)

How does one define an array of StringVar? If that is not possible, what
would be an alternative approach to the idea in the  code fragment above?

Dr Joachim Schambach
The University of Texas at Austin
Department of Physics
1 University Station C1600
Austin, Texas 78712-0264, USA
Phone: (512) 471-1303; FAX: (814) 295-5111
e-mail: jschamba at

More information about the Python-list mailing list