[Tutor] Tkinter script error.
Rick Pasotto
rickp@telocity.com
Thu, 13 Jun 2002 16:16:37 -0400
OK, now, confess. You didn't cut-n-paste, did you?
The line in your message:
> b = Button(top, text="OK", command=self.ok)
in your code is probably:
> b = Button(top, test="OK", command=self.ok)
On Thu, Jun 13, 2002 at 02:45:59PM -0500, SA wrote:
> 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
>
>
>
>
>
>
> _______________________________________________
> Tutor maillist - Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
--
"Love is much like a wild rose, beautiful and calm, but willing to draw
blood in its defense."
-- Mark A. Overby
Rick Pasotto rickp@telocity.com http://www.niof.net