Tal Einat added the comment: I put the try/except outside of the loop on purpose. If calling the widget's unbind() method fails once, it will fail forever afterwards.
If you prefer a different spelling, move the try/except into the loop, and break out of the loop in case of an exception: for seq, id in self.handlerids: try: self.widget.unbind(self.widgetinst, seq, id) except _tkinter.TclError: break As for avoiding the exception in the first place, I'm sure figuring out how IDLE shuts down would be a lot of work, and I honestly don't think it's necessary. Note that this problem is triggered in a __del__() method; making sure these are called at a proper time is problematic because the timing depends on the GC. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue20167> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com