[Tkinter-discuss] Catching exceptions

jepler at unpythonic.net jepler at unpythonic.net
Tue Jan 31 14:19:18 CET 2006


Here's a snippet I have laying around.  It doesn't exactly do what you
ask, but maybe it's a starting point.  You might see what the cited sf
tracker item is about as well.

# Print Tk errors to stdout. python.org/sf/639266
import Tkinter 
OldTk = Tkinter.Tk
class Tk(OldTk):
    def __init__(self, *args, **kw):
        OldTk.__init__(self, *args, **kw)
        self.tk.createcommand('tkerror', self.tkerror)

    def tkerror(self, arg):
        print "TCL error in asynchronous code:"
        print self.tk.call("set", "errorInfo")
Tkinter.Tk = Tk


More information about the Tkinter-discuss mailing list