Tkinter question regarding StringVar() usage.

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


Hi,

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/Tkinter.py", line 110, in __init__
    Variable.__init__(self, master)
  File "/usr/lib/python1.5/lib-tk/Tkinter.py", line 85, in __init__
    self._tk = master.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,
    tjg.

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




More information about the Python-list mailing list