没有
report_callback_exception做到这一点:
import tracebackimport tkMessageBox# You would normally put that on the App classdef show_error(self, *args): err = traceback.format_exception(*args) tkMessageBox.showerror('Exception',err)# but this works tootk.Tk.report_callback_exception = show_error如果您没有将“ Tkinter as tk”导入,请执行
Tkinter.Tk.report_callback_exception = show_error



