Tkinter(newbie) Inside Pythonwin

Gordon McLeod Gordon.McLeod at wolfson.co.uk
Tue Sep 26 08:57:55 EDT 2000


I'm having problems running a simple example from Fredrik Lundh's An
Introduction to Tkinter book in Pythonwin.

http://www.pythonware.com/library/tkinter/introduction/hello-again.htm

When I run from windows explorer it works fine, but from pythonwin
(1.5.2) the QUIT button doesn't close the window. The The tk window is
left on the screen and running again creates more tk windows. The window
'X' box closes the window in both, and the hello button works fine in
both.

Is there a missing destroy call or something?

I reproduce the example below:

# File: hello2.py Copyright © 1999 by Fredrik Lundh

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

Thanks,

Gordon McLeod,




More information about the Python-list mailing list