Newbie alert
Valone, Toren W.
TValone at DMV.CA.gov
Wed Feb 2 18:44:52 EST 2005
Ok, new to Python and Tkinter.. Following along examples in book, got to
dialog windows example coded this
# dialog1.py
from Tkinter import *
class Mydialog:
def _int_(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)
When I run it IDLE
gives me this
Traceback (most recent call last):
File "C:/Python24/dialog1.py", line 29, in -toplevel-
d = MyDialog(root)
NameError: name 'MyDialog' is not defined
I have a feeling this is something very simple, but I cannot figure it out.
Help!
More information about the Python-list
mailing list