Tkinter question regarding StringVar() usage.

Timothy Grant tjg at
Sat Mar 11 00:19:50 CET 2000


I know I am missing something ridiculously simple here, but how come I
cannot do the following...

>>> class test:
...     def __init__(self):
...             self.x = StringVar()
>>> tjg = test()
Traceback (innermost last):
  File "<stdin>", line 1, in ?
  File "<stdin>", line 3, in __init__
  File "/usr/lib/python1.5/lib-tk/", line 110, in __init__
    Variable.__init__(self, master)
  File "/usr/lib/python1.5/lib-tk/", line 85, in __init__
    self._tk =
AttributeError: 'None' object has no attribute 'tk'

I am trying to create a class that has several StringVar instances as
attributes, but it doesn't seem to work the way I'd like.

All help is greatly appreciated.

Stand Fast,

Chief Technology Officer              tjg at
Red Hat Certified Engineer  
Avalon Technology Group, Inc.                   (503) 246-3630
>>>>>>>>>>>>Linux...Because rebooting isn't normal<<<<<<<<<<<<

More information about the Python-list mailing list