Message60280
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()
|
|
Date |
User |
Action |
Args |
2008-01-20 09:55:47 | admin | link | issue639266 messages |
2008-01-20 09:55:47 | admin | create | |
|