I'm building an application involving both twisted and Tkinter. Since twisted co-opts <widget>.mainloop() in its reactor.run(), and since it behaves very badly if the application quits without reactor.stop() running, I attach the following function to '<Destroy>' in the main window (root = Tk()):
def stop_reactor_bind(x): reactor.stop() Then: root.bind('<Destroy>',stop_reactor_bind) The problem, however, comes that when I add a Text widget inside the root window, upon destroying the window (closing it) the callback seems to execute twice. In interactive testing, it's executed once per widget inside the root window. Since twisted doesn't take multiple reactor.stop()s gracefully, how (short of wrapping this inside a class/scope that keeps state) can I ensure that the callback executes only once? Am I attaching to the wrong signal? -- http://mail.python.org/mailman/listinfo/python-list