newbie question on Fredrik Lundh's simple script
John Boik
johnboik at sbcglobal.net
Tue Jul 2 15:54:53 EDT 2002
Hello. I am new to Python and Tkinter and was trying out the Fredrik Lundh
scripts from "An Introduction to Tkinter", and ran across a problem. BTW, I
am running the latest version of Python on a windows XP system. His simple
Hello2.py script does not act as it should on my machine, I think. The
script is:
# File: hello2.py
from Tkinter import *
class App:
def __init__(self, master):
frame = Frame(master)
frame.pack()
self.button = Button(frame, text="QUIT", fg="red",
command=frame.quit)
self.button.pack(side=LEFT)
self.hi_there = Button(frame, text="Hello", command=self.say_hi)
self.hi_there.pack(side=LEFT)
def say_hi(self):
print "hi there, everyone!"
root = Tk()
app = App(root)
root.mainloop()
Here is the problem. The frame pops up OK, but when I press the Quit button
nothing happens. When I press it twice, Python shuts down. According to
the script (command=frame.quit), the Quit button is only supposed to close
the frame, not shut down Python. Any ideas on what may be happening?
Thanks. John
More information about the Python-list
mailing list