A Simple Tkinter Control Program--Slight Problem

W. eWatson notvalid2 at sbcglobal.net
Wed Mar 4 13:09:10 EST 2009


Here's what I think the author meant in discussing a control variable sample 
program. <http://effbot.org/tkinterbook/entry.htm>

from Tkinter import *

v=Tk.StringVar()

e = Entry(master, textvariable=v)
e.pack()
e.focus_set()

v.set("a default value")
s = v.get()

mainloop()

The problem is that Python objects to v=.
     v=Tk.StringVar()
AttributeError: class Tk has no attribute 'StringVar'

What corrects this?
-- 
                                W. eWatson

              (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
               Obz Site:  39° 15' 7" N, 121° 2' 32" W, 2700 feet

                     Web Page: <www.speckledwithstars.net/>




More information about the Python-list mailing list