gtk.gdk.Event — an object representing an event from the windowing system
Contain only the fields that are common to all event types.
Generated when all or part of a window becomes visible and needs to be redrawn.
Generated when the pointer moves.
Used for button press and button release events.
Double and triple-clicks result in a sequence of events being received. For double-clicks the order of events will be:
Note that the first click is received just like a normal button press, while the second click results in a gtk.gdk.2BUTTON_PRESS being received just after the gtk.gdk.BUTTON_PRESS.
Triple-clicks are very similar to double-clicks, except that gtk.gdk.3BUTTON_PRESS is inserted after the third click. The order of the events is:
For a double click to occur, the second button press must occur within 1/4 of a second of the first. For a triple click to occur, the third button press must also occur within 1/2 second of the first button press.
Generated for a key press or key release event.
Generated when the pointer enters or leaves a window.
Describes a change of keyboard focus.
Generated when a window size or position has changed.
Describes a property change on a window.
Generated when a selection is requested or ownership of a selection is taken over by another client application.
Proximity events are generated when using GDK's wrapper for the XInput extension. The XInput extension is an add-on for standard X that allows you to use nonstandard devices such as graphics tablets. A proximity event indicates that the stylus has moved in or out of contact with the tablet, or perhaps that the user's finger has moved in or out of contact with a touch screen.
Generated during Drag and Drop operations.
An event sent by another client application.
Generated when the window visibility status has changed.
Generated from button presses for the buttons 4 to 7. Wheel mice are usually configured to generate button press events for buttons 4 and 5 when the wheel is turned.
Generated when the state of a toplevel window changes.
Generated when a setting is modified.
This Event type is available in PyGTK 2.8 and above.
Generated when the owner of a selection changes. On X11, this information is only available if the X server supports the XFIXES extension.
This Event type is available in PyGTK 2.8 and above.
Generated when a pointer or keyboard grab is broken. On X11, this happens when the grab window becomes unviewable (i.e. it or one of its ancestors is unmapped), or if the same application grabs the pointer or keyboard again. Note that implicit grabs (which are initiated by button presses) can also cause gtk.gdk.GRAB_BROKEN events.
A gtk.gdk.Event represents an event from the windowing system. The gtk.gdk.Event methods are usually not used by applications since the PyGTK main loop generates signals and invokes the appropriate signal handler. The event types are:
|gtk.gdk.NOTHING||a special code to indicate a null event.|
|gtk.gdk.DELETE||the window manager has requested that the toplevel window be hidden or destroyed, usually when the user clicks on a special icon in the title bar.|
|gtk.gdk.DESTROY||the window has been destroyed.|
|gtk.gdk.EXPOSE||all or part of the window has become visible and needs to be redrawn.|
|gtk.gdk.MOTION_NOTIFY||the pointer (usually a mouse) has moved.|
|gtk.gdk.BUTTON_PRESS||a mouse button has been pressed.|
|gtk.gdk._2BUTTON_PRESS||a mouse button has been double-clicked (clicked twice within a short period of time). Note that each click also generates a gtk.gdk.BUTTON_PRESS event.|
|gtk.gdk._3BUTTON_PRESS||a mouse button has been clicked 3 times in a short period of time. Note that each click also generates a gtk.gdk.BUTTON_PRESS event.|
|gtk.gdk.BUTTON_RELEASE||a mouse button has been released.|
|gtk.gdk.KEY_PRESS||a key has been pressed.|
|gtk.gdk.KEY_RELEASE||a key has been released.|
|gtk.gdk.ENTER_NOTIFY||the pointer has entered the window.|
|gtk.gdk.LEAVE_NOTIFY||the pointer has left the window.|
|gtk.gdk.FOCUS_CHANGE||the keyboard focus has entered or left the window.|
|gtk.gdk.CONFIGURE||the size, position or stacking order of the window has changed. Note that PyGTK discards these events for gtk.gdk.WINDOW_CHILD windows.|
|gtk.gdk.MAP||the window has been mapped.|
|gtk.gdk.UNMA||the window has been unmapped.|
|gtk.gdk.PROPERTY_NOTIFY||a property on the window has been changed or deleted.|
|gtk.gdk.SELECTION_CLEAR||the application has lost ownership of a selection.|
|gtk.gdk.SELECTION_REQUEST||another application has requested a selection.|
|gtk.gdk.SELECTION_NOTIFY||a selection has been received.|
|gtk.gdk.PROXIMITY_IN||an input device has moved into contact with a sensing surface (e.g. a touchscreen or graphics tablet).|
|gtk.gdk.PROXIMITY_OUT||an input device has moved out of contact with a sensing surface.|
|gtk.gdk.DRAG_ENTER||the mouse has entered the window while a drag is in progress.|
|gtk.gdk.DRAG_LEAVE||the mouse has left the window while a drag is in progress|
|gtk.gdk.DRAG_MOTION||the mouse has moved in the window while a drag is in progress.|
|gtk.gdk.DRAG_STATUS||the status of the drag operation initiated by the window has changed.|
|gtk.gdk.DROP_START||a drop operation onto the window has started.|
|gtk.gdk.DROP_FINISHED||the drop operation initiated by the window has completed.|
|gtk.gdk.CLIENT_EVENT||a message has been received from another application.|
|gtk.gdk.VISIBILITY_NOTIFY||the window visibility status has changed.|
|gtk.gdk.NO_EXPOSE||indicates that the source region was completely available when parts of a drawable were copied. This is not very useful.|
|gtk.gdk.SCROLL||a scroll had occurred for a window|
|gtk.gdk.WINDOW_STATE||the window state has changed|
|gtk.gdk.SETTING||a setting has changed|
|gtk.gdk.OWNER_CHANGE||the owner of a selection has changed. Added in GTK+ 2.6|
|gtk.gdk.GRAB_BROKEN||a pointer or keyboard grab was broken. Added in GTK+ 2.8.|
A set of bit-flags is used to indicate which events a window is to receive. Most of these masks map onto one or more of the event types above. Use the gtk.Widget.set_events() method to indicate which events a widget should receive.
The gtk.gdk.POINTER_MOTION_HINT_MASK is a special mask which is used to reduce the number of gtk.gdk.MOTION_NOTIFY events received. Normally a gtk.gdk.MOTION_NOTIFY event is received each time the mouse moves. However, if the application spends a lot of time processing the event (updating the display, for example), it can easily lag behind the position of the mouse. When using the gtk.gdk.POINTER_MOTION_HINT_MASK the server will only send a single gtk.gdk.MOTION_NOTIFY event (which is marked as a hint) until the application asks for more, by calling the gtk.gdk.Window.get_pointer() method. The masks are:
gtk.gdk.ALL_EVENTS_MASK is a combination of all the event masks.
|type :||a event type - see the Description above|
|Returns :||a newly-allocated gtk.gdk.Event.|
This constructor is available in PyGTK 2.2 and above.
Creates a new gtk.gdk.Event of the given type. All fields are set to 0.
The put() method appends a copy of the given event onto the tail of the event queue.
|Returns :||a copy of the event|
The copy() method copies the event, copying or incrementing the reference count of the resources associated with it (e.g. windows and strings).
This method is deprecated and should not be used since it may crash your application.
The free() method frees the event, freeing or decrementing any resources associated with it. Note that this method should only be called on gtk.gdk.Event objects returned from methods or functions such as gtk.gdk.event_peek(), gtk.gdk.event_get(), gtk.gdk.event_get_graphics_expose() and copy().
|Returns :||the time stamp field from the event|
The get_time() method returns the time stamp from the event, if there is one; otherwise returns 0.
|Returns :||the modifier state|
This method is available in PyGTK 2.4 and above.
The get_state() method returns the value of the modifier "state" field. If the event has no "state" field the empty state value (0) is returned. The "state" field contains a modifier type: a combination of the GDK Modifier Constants.
These events do not have any additional attributes.
|Returns :||a tuple containing the event window x and y coordinates or an empty tuple if the event did not deliver event window coordinates|
The get_coords() method returns a tuple containing the x and y coordinates of an event relative to the event gtk.gdk.Window or an empty tuple if the event did not deliver event window coordinates.
|Returns :||a tuple containing the root window x and y coordinates or an empty tuple if the event did not deliver root window coordinates|
The get_root_coords() method returns a tuple containing the x and y coordinates from an event relative to the root window or an empty tuple if the event did not deliver root window coordinates.
|axis_use :||the axis use to look for|
|Returns :||the value found or None if the axis was not found.|
The get_axis() method returns the axis value for the axis use specified by axis_use from an event structure. The value of axis_use must be one of:
|gtk.gdk.AXIS_IGNORE||the axis is ignored.|
|gtk.gdk.AXIS_X||the axis is used as the x axis.|
|gtk.gdk.AXIS_Y||the axis is used as the y axis.|
|gtk.gdk.AXIS_PRESSURE||the axis is used for pressure information.|
|gtk.gdk.AXIS_XTILT||the axis is used for x tilt information.|
|gtk.gdk.AXIS_YTILT||the axis is used for y tilt information.|
|gtk.gdk.AXIS_WHEEL||the axis is used for wheel information.|
|gtk.gdk.AXIS_LAST||a constant equal to the numerically highest axis value.|
If an axis with the specified axis use is not found, this method returns None.
|screen :||a gtk.gdk.Screen|
This method is available in PyGTK 2.2 and above.
|Returns :||the screen for the event|
This method is available in PyGTK 2.2 and above.
The get_screen() method returns the gtk.gdk.Screen for the event. The screen is typically the screen for the event window, but for events such as mouse events, it is the screen where the the pointer was when the event occurs - that is, the screen that has the root window for the event.
|Returns :||TRUE if any events are pending|
The gtk.gdk.events_pending() function returns TRUE if any events are ready to be processed.
|Returns :||a copy of the first gtk.gdk.Event on the event queue or None if there is no event in the queue.|
The gtk.gdk.event_peek() function returns a copy of the first gtk.gdk.Event on the event queue or None if there is no event on the event queue.
|Returns :||the next gtk.gdk.Event to be processed, or None if no events are pending.|
The gtk.gdk.event_get() function returns the next gtk.gdk.Event to be processed or None if no events are available.
|window :||a gtk.gdk.Window|
|Returns :||an expose gtk.gdk.Event if a GraphicsExpose was received, or None if a NoExpose event was received.|
The gtk.gdk.event_get_graphics_expose() function waits for and returns returns an expose gtk.gdk.Event if a GraphicsExpose was received, or None if a NoExpose event was received.
|show_events :||if TRUE output event debug information|
The gtk.gdk.set_show_events() function sets the debug events flag if show_events is TRUE. Otherwise the debug events flag is unset.
|Returns :||TRUE if the debug events flag is set.|
The gtk.gdk.get_show_events() function returns the setting of the internal debug events flag.
|func :||the function to call to handle events from GDK or None.|
|data :||user data to pass to the function.|
This function is available in PyGTK 2.10 and above.
The gtk.gdk.event_handler_set() function specifies func as the function to call to handle all events from GDK. data is the optional user data to pass to func.
The signature of func is:
def func(event, user_data):
where event is the gtk.gdk.Event and user_data is data.