[Tkinter-discuss] Problem using StringVar()

Chris Roy-Smith chris_roysmith at internode.on.net
Mon Sep 1 04:46:53 CEST 2014

Just trying to learn to use Tkinter.

python 2.7.3  OS Ubuntu 12.4

This code
import Tkinter
top = Tkinter.Tk()

v = top.StringVar()
Label(master, textvariable=v).pack()


returns this error message

Traceback (most recent call last):
   File "./hello.py", line 5, in <module>
     v = top.StringVar()
   File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1767, in __getattr__
     return getattr(self.tk, attr)
AttributeError: StringVar

Please what am I doing wrong?

More information about the Tkinter-discuss mailing list