Fredrik Lundh schreef op de 16e dag van de slachtmaand van het jaar 2005: > Peter Kleiweg wrote: > > > I want the program to behave identical if the 'close' button of > > the application window is clicked. I tried the code below, > > using a class derived from Tk that redefines the destroy > > method. That seems to work. At least on Linux. > > > > My questions: > > > > Is this the correct and save way to do this? Will it work on any > > operating system? Shouldn't I do some event capturing instead? > > the right way to do this is to implement a WM_DELETE_WINDOW > protocol handler: > > http://effbot.org/tkinterbook/tkinter-events-and-bindings.htm#protocols > > in your case, adding > > root.protocol("WM_DELETE_WINDOW", root.destroy) > > to the right place should be enough.
Yes, that works. By the way, this example ends the program with root.destroy(). I used root.quit(). Is there a reason for using one or the other, or does it not matter? -- Peter Kleiweg L:NL,af,da,de,en,ia,nds,no,sv,(fr,it) S:NL,de,en,(da,ia) info: http://www.let.rug.nl/~kleiweg/ls.html -- http://mail.python.org/mailman/listinfo/python-list