catching X client kills in Tkinter
Timothy Docker
timd at macquarie.com.au
Tue Feb 22 17:40:59 EST 2000
Is it possible to catch the failure of a Tkinter based application
when the server connection is closed (ie under X11 and unix). For
example in the script below, if I push the button, or click on the
window manager close button, "Done" is printed as expected....
from Tkinter import *
def done(): x.quit()
x = Button(text="Quit",command=done)
x.pack()
try:
x.mainloop()
finally:
print "Done"
On the other hand, if the X server exits, or I do an xkill, then the
following message is printed
X connection to :0.0 broken (explicit kill or server shutdown).
I'd like to do some cleaning up before exiting - is there any way to
do this?
Thanks for any tips!
--------------------------------------------------------------
Tim Docker timd at macquarie.com.au
More information about the Python-list
mailing list