I have a Python script which uses tkinter.messagebox
to display an error message with traceback details if an unexpected exception occurs.
import tkinter.messagebox as tm
import traceback
try:
1/0
except Exception as error:
message = "An error has occurred: '" + str(error) + "'."
detail = traceback.format_exc()
tm.showerror(title="Error", message=message, detail=detail)
Displaying tracebacks with the -detail
attribute has a few drawbacks.
- Traceback details aren't helpful for the average user.
- Testers can't easily select and copy text from a messagebox
- Complex errors can have large tracebacks which span dozens of lines.
Instead of displaying error details by default, I would like to add a "show details" button which would display more information in a read-only text field.
How can I add a "show details" button to a tkinter messagebox?
from How can I add a "show details" button to a tkinter messagebox?
No comments:
Post a Comment