[Tutor] Tkinter script error.

Alan Trautman ATrautman@perryjudds.com
Thu, 13 Jun 2002 15:31:35 -0500


-----Original Message-----
From: Danny Yoo [mailto:dyoo@hkn.eecs.berkeley.edu]
Sent: Thursday, June 13, 2002 3:29 PM
To: SA
Cc: tutor
Subject: Re: [Tutor] Tkinter script error.




On Thu, 13 Jun 2002, SA wrote:

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


This script run well on my PC using IDLE are you using a command line
interface with this?