[Tutor] Tkinter script error.

SA sarmstrong13@mac.com
Thu, 13 Jun 2002 14:45:59 -0500


Hi Everyone-

    I'm practicing Tkinter from
http://www.pythonware.com/library/tkinter/introduction/dialog-windows.htm.
When I run the following Python script:

from Tkinter import *

class MyDialog:

    def __init__(self, parent):

        top = self.top = Toplevel(parent)

        Label(top, text="Value").pack()

        self.e = Entry(top)
        self.e.pack(padx=5)

        b = Button(top, text="OK", command=self.ok)
        b.pack(pady=5)

    def ok(self):

        print "value is", self.e.get()

        self.top.destroy()

root = Tk()
Button(root, text="Hello!").pack()
root.update()

d = MyDialog(root)

root.wait_window(d.top)

I get the following error:

Traceback (most recent call last):
  File "(string)", line 22 in ?
  File "(string)", line 11 in __init__
  File "/sw/lib/python2.2/lib-tk/Tkinter.py", line 1817, in __init__
    Widget.__init__(self, master, 'button', cnf, kw)
  File "/sw/lib/python2.2/lib-tk/Tkinter.py", line 1756, in __init__
    self.tk.call(
TclError: unkown option "-test"


Any ideas what is causing this?
Thanks.
SA