catching X client kills in Tkinter

Jerry 2jerry at writeme.com
Tue Feb 22 18:58:44 EST 2000


Are you sure script exit ?
try ps -edf I think jobs is here.
I'm not sure killing displayer (X server) will explicitly kill the
x.mainloop too ?
don't have UNIX o.s. near me to try it .

Jerry the foolish dracomorpheus, jerome VACHER - france - Paris -

Timothy Docker a écrit dans le message ...
>
>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