A Simple Tkinter Control Program--Slight Problem

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Wed Mar 4 20:39:14 CET 2009


On Wed, 04 Mar 2009 10:09:10 -0800, W. eWatson wrote:

> 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?

Learn how to copy code 1:1 from a web page or understand Python's import 
and namespaces.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list