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 gpolo
Recipients gpolo, idiscovery, jepler, loewis
Date 2008-10-24.12:16:46
SpamBayes Score 3.519588e-10
Marked as misclassified No
Message-id <1224850608.39.0.284412969589.issue639266@psf.upfronthosting.co.za>
In-reply-to
Content
Uhm, long time without discussion but I'm hoping someone interested may
read this.

You have to provide a "bgerror" command to Tcl, so it will get invoked
when a background error happens. Either _tkinter.c could create one for
an interpreter is created or Tkinter.py could create one when a Tk
instance is created. The command will be invoked with a single argument,
the background error message.


If you want to play with it:

import Tkinter

def bgerr_handler(msg):
    print msg, "<<"

root = Tkinter.Tk()
root.tk.createcommand("bgerror", bgerr_handler)
btn = Tkinter.Button(command="expr 1/0")
btn.pack()
root.mainloop()


To get some form of traceback you would need to play with inspect and
traceback modules. But in both cases (in the example above and using
inspect) an exception isn't raised at all, and if you try raising then
Tcl will think the bgerror handler failed and will tell you that. For
this reason I would prefer to leave to _tkinter.c to handle this.
History
Date User Action Args
2008-10-24 12:16:48gpolosetrecipients: + gpolo, loewis, jepler, idiscovery
2008-10-24 12:16:48gpolosetmessageid: <1224850608.39.0.284412969589.issue639266@psf.upfronthosting.co.za>
2008-10-24 12:16:47gpololinkissue639266 messages
2008-10-24 12:16:46gpolocreate