catching X client kills in Tkinter

Randall Hopper aa8vb at yahoo.com
Wed Mar 1 10:06:19 EST 2000


Timothy Docker:
 |
 |Randall Hopper writes:
 |
 | >  |Is it possible to catch the failure of a Tkinter based application
 | >  |when the server connection is closed (ie under X11 and unix).
 | > 
 | > For close (typically bound to the "X" window manager icon):
 | > 
 | >   top.protocol( 'WM_DELETE_WINDOW', MyCleanupFunct )
 | > 
 | > I don't know if you can catch an X kill (maybe with signal handlers, unless
 | > it materializes as a SIGKILL or another uncatchable signal).
 |
 |Unfortunately this doesn't catch the situation where the X server
 |exits, or forcible closes the socket connection (done byt the xkill
 |command). 

Right, that would be an kill, not a close.

When the X server is coming down, I don't think there's a guarentee you'll
even get a catchable event.

XSetIOHandler will handle some of these cases ("e.g. not kill -9").  Safest
bet might be to run your GUI in a subprocess and have the parent "do the
right thing" when its child is killed.


-- 
Randall Hopper
aa8vb at yahoo.com




More information about the Python-list mailing list