Exception classes
PyGUI defines the following exception classes for use by application code.
- Cancel
This exception can be raised to abort an operation, such as in response
to the user clicking a Cancel button. It is silently caught by the main
event loop.
When writing code, you should keep the possibility of Cancel exceptions
in mind, and make judicious use of try-finally to clean up after
operations that could be cancelled part way through.
- ApplicationError(message [, detail])
This exception can be raised to signal an error that should be reported
to the user. It is caught by the main event loop and a suitable alert
displayed.
The message should be a brief description of the error, including primary relevant information. The detail may be a longer discourse providing further information about the cause of the error and/or possible remedies. For example,
-
- "Unable to open the file 'InterestingStuff.txt'".
- detail:
- "Someone has spread peanut butter on the disk. Please clean it and try again."
---