Thus spoketh Michael Lange <klappn...@web.de> 
unto us on Sat, 15 Jan 2011 21:48:31 +0100:

> Hi,
> 
> I encountered a strange problem with Tkinter and the handling of signals
> (on debian linux, both with Python-2.5 / Tk-8.4 and  Python-2.6 /
> Tk-8.6). The problem resembles much the one described in this old
> message:
> 
> http://web.archiveorange.com/archive/v/5H3d1OLg2fjze5McyfSL
> 

Ok, after reading the answer to this old question for a second time, I
found a ugly but working solution, changing the example into:

####################################
import Tkinter
import signal

root = Tkinter.Tk()

def poll():
    root.after(500, poll)
root.after(500, poll)

def handle_signal(signum, frame):
    print 'Caught signal # %d' % signum
signal.signal(2, handle_signal)

root.mainloop()
###################################

Apparently, as soon as root.after() is called the signal reaches the
window. Probably there is some active polling-loop like this in the other
app I mentioned in the first post. Still it seems like a pain in the neck
if you need the loop just for signal handling :(

Best regards

Michael

.-.. .. ...- .   .-.. --- -. --.   .- -. -..   .--. .-. --- ... .--. . .-.

Death, when unnecessary, is a tragic thing.
                -- Flint, "Requiem for Methuselah", stardate 5843.7
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to