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=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 with the msg:
   AttributeError: 'NoneType' object has no attribute 'tk'

What corrects this? The full sample program below it runs fine:
=======================
from Tkinter import *

master = Tk()

e = Entry(master)
e.pack()

e.focus_set()

def callback():
    print e.get()

b = Button(master, text="get", width=10, command=callback)
b.pack()

mainloop()
--
                               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/>



_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to