Tkinter and signals

Samuel L. Bayer sam at mitre.org
Mon Jan 31 17:00:12 EST 2000


All -

When I set a signal handler (SIGINT, SIGTERM, etc.) in a Tkinter
application and send the signal to it, the application doesn't actually
vanish from the screen until I move the mouse over it. In particular,
the signal isn't even *seen* by the app until I move the mouse over it.
A couple people have reported this previously, but no general solution
has been posted. For instance, Alexandre Ferrieux wrote on 2/11/1999:

"It is a known issue with the Tcl/Tk event loop, that when a signal is
configured to
 *restart* system calls it interrupts, the event loop will not get a
chance to call
 the internal mechanism needed to detect the flags set by the low-level
signal
 handler (AsyncReady). Thus, signals-aware versions of Tcl should
configure the signal handlers *without* the SA_RESTART flag, otherwise
the final script-level callback is only called after the
 next GUI event (mouse...). I don't know the case of TkInter, though."

This comment doesn't apply to my situation, since I'm trying to exit the
application. Furthermore, the wish executable built from the identical
library *does* exit appropriately when the signal is sent. I've tried
this with both 1.5 and 1.5.2 (both using Tk 8.0, I think), and I get the
same behavior in each case.

Does anyone have a solution to this problem? Please CC me directly in
your response, since I'm not reading c.l.p regularly nowadays.

Thanks in advance -
Sam Bayer
The MITRE Corporation
sam at mitre.org




More information about the Python-list mailing list