error.CatchError is an object which can be used as an error
handler. It collects an error matching any of the specified types,
which can be retrieved later. If several errors occures, only the last
Create a new error handler object. Initialize by providing all error classes you are interested in as arguments. If no error classes are provided at all, this means that all errors will be considered.
error.CatchError object as the
to X object methods. If these methods generated any errors matching the
ones specified, it can be retrieved with the following functions:
Return the last error object caught, or None if no matching errors has occured.
Return the request object for the last error caught, or None if no matching errors has occured.
error.CatchError objects can be reused:
Forget any caught error.
Since the X protocol is mostly asynchronous any error we're watching for
might not have been recieved when we call
get_error. To make
sure that the request has been processed by the server and any error
generated has been received by the Xlib, we must synchronize with the
An example of using
# Resize and the foo window # If it has been destroyed since we looked at it the last time, # reset variable foo to None # Create a error handler for BadWindow errors ec = error.CatchError(error.BadWindow) # Perform the operation foo.configure(width = 100, height = 200, onerror = ec) # Sync communication with server display.sync() # And check if there was any error if ec.get_error(): foo = None
Go to the first, previous, next, last section, table of contents.