[Tutor] First steps with Tkinter

etrade.griffiths at dsl.pipex.com etrade.griffiths at dsl.pipex.com
Thu Jan 26 19:20:48 CET 2006


Hi!

Just started trying to get to grips with Python and Tkinter.  Have Frederick 
Lundh's tutorial and am on program hello2.py which looks like this

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

I am running from inside Pythonwin 2.4 IDE under XP Pro and every time I run 
hello2.py it freezes when I press "QUIT".  The only way to kill it is through 
Alt-Ctrl-Del but this crashes Pythonwin.  Any workaround for this so that I 
can use Tkinter from inside the IDE?  BTW the same thing happend with IDLE

Thanks in advance

Alun Griffiths


More information about the Tutor mailing list