catching X client kills in Tkinter
timd at macquarie.com.au
Wed Mar 1 23:06:38 CET 2000
Randall Hopper writes:
> |Unfortunately this doesn't catch the situation where the X server
> |exits, or forcible closes the socket connection (done byt the xkill
> 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.
I seem to get to my callback for XSetIOHandler when the X server dies
or the xkill command is run. Not sure about guarantees, but this is
good enough for me.
> 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.
Yep, you're never going to catch a kill -9. Running in a subprocess
would be one way, but this could get messy, as all the state for
cleaning up is available in the program being terminated.
More information about the Python-list