Tkinter and signals

pehr anderson pehr at pehr.net
Sat Feb 12 13:22:08 EST 2000


One thing Tkinter makes fairly easy is to 
set up an alarm that wakes up 100msec in the
future, checks for conditions and re-enables its self.
As much as I hate poll-loop programming, this
is the only thing that comes to mind. 
If somebody has a better idea please let me know.

I'm currently using this technique to wait on 
a select() call that monitors several handles for
incomming data (to be fed directly to the gui).
It wakes up every 200msec and updates the display.
Rather than cope with any issues of thread-safety
I'm using this bad programming technique which 
gets the job done.

	-pehr


"Samuel L. Bayer" wrote:
> 
> 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