This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jepler
Recipients
Date 2002-11-17.15:39:37
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Logged In: YES 
user_id=2772

You could create a subclass of Tk that creates a different
'tkerror' command.

Anyway, CallWrapper (used when a function is passed to
functions like .after_idle()) calls
widget._report_exception, which calls
Tk.report_callback_exception.  So you can override this
function too.

Neither of these things require changing Tkinter.py.

I don't seem to be permitted to attach a file, so I'm forced
to paste the code.

import Tkinter as _Tkinter

class Tk(_Tkinter.Tk):
    def __init__(self, *args, **kw):
        _Tkinter.Tk.__init__(self, *args, **kw)
        self.tk.createcommand('tkerror', self.tkerror)

    def report_callback_exception(self, exc, val, tb):
        print "callback exception", exc

    def tkerror(self, *args):
        print "tkerror", args

if __name__ == '__main__':
    w = Tk()
    w.after_idle(lambda: 1/0)
    _Tkinter.Button(w, command="expr 1/0").pack()
    w.mainloop()
History
Date User Action Args
2008-01-20 09:55:47adminlinkissue639266 messages
2008-01-20 09:55:47admincreate