Tkinter: Why won't it work?

A.Newby deathtospam43423 at altavista.com
Wed Mar 27 00:25:23 EST 2002


Hi.

Below is an example exercise from "An Introduction to Tkinter" by Fredrik 
Lundh. It simply creates a box with a quit button in it. Problem is, 
everytime I click Quit, the program freezes. 

Is this a rare but well known bug with Tkinter, Python 2.2, or Windows 98? 
Or is more probable that it's cuz my system is screwed?


# 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()


-- 
cdewin at dingoblue.net.au



More information about the Python-list mailing list