The Python X Library: 5 Event Handling
Events are sent from the X server to the X client. Most of the event types deal with user input, but there are also event types used for inter-client communication.
Most X applications are built around an event loop, where the client waits for the server to send events. The client responds to the events, typically by doing one or more X requests.
5.1 Getting Events Waiting for events.
5.2 Selecting Events Selecting interesting events.
5.3 Event Types Details on all event types.
5.4 Sending Events Clients sending events to other clients.