Marc 'BlackJack' Rintsch wrote:
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
It wasn't a matter of copying. I had experimented with the code and found a note that suggested using Tk, and another way of getting the job. It didn't work. I missed removing it (Tk).

"Never assume!"--Spencer Tracy, cautioning Katharine Hepburn in a puzzle he is about to give her in the movie Desk Set.

Here's the segment the author singled out:

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

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


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

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to