gtk.gdk.Event

gtk.gdk.Event — an object representing an event from the windowing system

Synopsis

class gtk.gdk.Event(gobject.GBoxed):
    gtk.gdk.Event(type)
def put()
def copy()
def free()
def get_time()
def get_state(state)
def get_coords()
def get_root_coords()
def get_axis(axis_use)
def set_screen(screen)
def get_screen()
Functions

    def gtk.gdk.events_pending()
def gtk.gdk.event_peek()
def gtk.gdk.event_get()
def gtk.gdk.event_get_graphics_expose(window)
def gtk.gdk.set_show_events(show_events)
def gtk.gdk.get_show_events()
def gtk.gdk.event_handler_set(func, data=None)
def gtk.gdk.event_request_motions(event)

Attributes

The attributes available for a gtk.gdk.Event are dependent on the type of the event. The event types are described in the Description section.

gtk.gdk.NOTHING

"type"ReadThe event type - see the list below in the Description section
"window"Read/WriteThe gtk.gdk.Window the event occurred on.
"send_event"Read/WriteTrue if the event was sent explicitly.

Contain only the fields that are common to all event types.

gtk.gdk.EXPOSE

"type"ReadThe event type - see the list below in the Description section
"window"Read/WriteThe gtk.gdk.Window the event occurred on.
"send_event"Read/WriteTrue if the event was sent explicitly.
"area"Read/WriteThe bounding box of the area to be redrawn
"count"Read/WriteThe number of contiguous gtk.gdk.EXPOSE events following this one. The only use for this is "exposure compression", i.e. handling all contiguous gtk.gdk.EXPOSE events in one go, though PyGTK performs some exposure compression so this is not normally needed.

Generated when all or part of a window becomes visible and needs to be redrawn.

gtk.gdk.MOTION_NOTIFY

"type"ReadThe event type - see the list below in the Description section
"window"Read/WriteThe gtk.gdk.Window the event occurred on.
"send_event"Read/WriteTrue if the event was sent explicitly.
"time"Read/WriteThe time of the event in milliseconds.
"x"Read/WriteThe x coordinate of the pointer relative to the window.
"y"Read/WriteThe y coordinate of the pointer relative to the window.
"axes"Readx, y translated to the axes of device, or None if device is the mouse.
"state"Read/WriteA bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt) and the pointer buttons.
"is_hint"Read/WriteTrue if the gdk.POINTER_MOTION_HINT_MASK is set.
"device"ReadThe device where the event originated.
"x_root"Read/WriteThe x coordinate of the pointer relative to the root of the screen.
"y_root"Read/WriteThe y coordinate of the pointer relative to the root of the screen.

Generated when the pointer moves.

gtk.gdk.BUTTON_PRESS

"type"ReadThe event type - see the list below in the Description section
"window"Read/WriteThe gtk.gdk.Window the event occurred on.
"send_event"Read/WriteTrue if the event was sent explicitly.
"time"Read/WriteThe time of the event in milliseconds.
"x"Read/WriteThe x coordinate of the pointer relative to the window.
"y"Read/WriteThe y coordinate of the pointer relative to the window.
"axes"Readx, y translated to the axes of device, or None if device is the mouse.
"state"Read/WriteA bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt) and the pointer buttons.
"button"Read/WriteThe button which was pressed or released, numbered from 1 to 5. Normally button 1 is the left mouse button, 2 is the middle button, and 3 is the right button. On 2-button mice, the middle button can often be simulated by pressing both mouse buttons together.
"device"ReadThe device where the event originated.
"x_root"Read/WriteThe x coordinate of the pointer relative to the root of the screen.
"y_root"Read/WriteThe y coordinate of the pointer relative to the root of the screen.

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:

  1. gtk.gdk.BUTTON_PRESS
  2. gtk.gdk.BUTTON_RELEASE
  3. gtk.gdk.BUTTON_PRESS
  4. gtk.gdk._2BUTTON_PRESS
  5. gtk.gdk.BUTTON_RELEASE

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:

  1. gtk.gdk.BUTTON_PRESS
  2. gtk.gdk.BUTTON_RELEASE
  3. gtk.gdk.BUTTON_PRESS
  4. gtk.gdk._2BUTTON_PRESS
  5. gtk.gdk.BUTTON_RELEASE
  6. gtk.gdk.BUTTON_PRESS
  7. gtk.gdk._3BUTTON_PRESS
  8. gtk.gdk.BUTTON_RELEASE

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.

gtk.gdk.KEY_PRESS

"type"ReadThe event type - see the list below in the Description section
"window"Read/WriteThe gtk.gdk.Window the event occurred on.
"send_event"Read/WriteTrue if the event was sent explicitly.
"time"Read/WriteThe time of the event in milliseconds.
"state"Read/WriteA bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt) and the pointer buttons.
"keyval"Read/WriteThe key that was pressed or released.
"string"Read/WriteA multi-byte string containing the composed characters resulting from the key press. When text is being input, in a gtk.Entry for example, it is these characters which should be added to the input buffer. When using Input Methods to support internationalized text input, the composed characters appear here after the pre-editing has been completed.
"hardware_keycode"Read/WriteThe raw code of the key that was pressed or released. Available in PyGTK 2.2 and above.
"group"Read/Writethe keyboard group. Available in PyGTK 2.4 and above.

Generated for a key press or key release event.

gtk.gdk.ENTER_NOTIFY

"type"ReadThe event type - see the list below in the Description section
"window"Read/WriteThe gtk.gdk.Window the event occurred on.
"send_event"Read/WriteTrue if the event was sent explicitly.
"subwindow"Read/WriteThe window that was entered or left.
"time"Read/WriteThe time of the event in milliseconds.
"x"Read/WriteThe x coordinate of the pointer relative to the window.
"y"Read/WriteThe y coordinate of the pointer relative to the window.
"x_root"Read/WriteThe x coordinate of the pointer relative to the root of the screen.
"y_root"Read/WriteThe y coordinate of the pointer relative to the root of the screen.
"mode"Read/WriteThe crossing mode (gtk.gdk.CROSSING_NORMAL, gtk.gdk.CROSSING_GRAB or gtk.gdk.CROSSING_UNGRAB).
"detail"Read/WriteThe kind of crossing that happened (gtk.gdk.NOTIFY_INFERIOR, gtk.gdk.NOTIFY_ANCESTOR, gtk.gdk.NOTIFY_VIRTUAL, gtk.gdk.NOTIFY_NONLINEAR or gtk.gdk.NOTIFY_NONLINEAR_VIRTUAL).
"focus"Read/WriteTrue if window is the focus window or an inferior.
"state"Read/WriteA bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt) and the pointer buttons.

Generated when the pointer enters or leaves a window.

gtk.gdk.FOCUS_CHANGE

"type"ReadThe event type - see the list below in the Description section
"window"Read/WriteThe gtk.gdk.Window the event occurred on.
"send_event"Read/WriteTrue if the event was sent explicitly.
"in_"Read/WriteTrue if the window has gained the keyboard focus, False if it has lost the focus.

Describes a change of keyboard focus.

gtk.gdk.CONFIGURE

"type"ReadThe event type - see the list below in the Description section
"window"Read/WriteThe gtk.gdk.Window the event occurred on.
"send_event"Read/WriteTrue if the event was sent explicitly.
"x"Read/WriteThe new x coordinate of the window relative to its parent.
"y"Read/WriteThe new y coordinate of the window relative to its parent.
"width"Read/WriteThe new width of the window.
"height"Read/WriteThe new height of the window.

Generated when a window size or position has changed.

gtk.gdk.PROPERTY_NOTIFY

"type"ReadThe event type - see the list below in the Description section
"window"Read/WriteThe gtk.gdk.Window the event occurred on.
"send_event"Read/WriteTrue if the event was sent explicitly.
"atom"ReadThe property that was changed.
"time"Read/WriteThe time of the event in milliseconds.
"state"Read/WriteThe property was changed (gtk.gdk.PROPERTY_NEW_VALUE) or deleted (gtk.gdk.PROPERTY_DELETE).

Describes a property change on a window.

gtk.gdk.SELECTION_CLEAR

"type"ReadThe event type - see the list below in the Description section
"window"Read/WriteThe gtk.gdk.Window the event occurred on.
"send_event"Read/WriteTrue if the event was sent explicitly.
"selection"ReadThe selection.
"target"ReadThe target to which the selection should be converted.
"property"ReadThe property in which to place the result of the conversion.
"requestor"Read/Writethe native window ID on which to place property.
"time"Read/WriteThe time of the event in milliseconds.

Generated when a selection is requested or ownership of a selection is taken over by another client application.

gtk.gdk.PROXIMITY_IN

"type"ReadThe event type - see the list below in the Description section
"window"Read/WriteThe gtk.gdk.Window the event occurred on.
"send_event"Read/WriteTrue if the event was sent explicitly.
"time"Read/WriteThe time of the event in milliseconds.
"device"ReadThe device where the event originated.

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.

gtk.gdk.DRAG_ENTER

"type"ReadThe event type - see the list below in the Description section
"window"Read/WriteThe gtk.gdk.Window the event occurred on.
"send_event"Read/WriteTrue if the event was sent explicitly.
"context"ReadThe gtk.gdk.DragContext for the current DND operation.
"time"Read/WriteThe time of the event in milliseconds.
"x_root"Read/WriteThe x coordinate of the pointer relative to the root of the screen only set for gtk.gdk.DRAG_MOTION and gtk.gdk.DROP_START.
"y_root"Read/WriteThe y coordinate of the pointer relative to the root of the screen only set for gtk.gdk.DRAG_MOTION and gtk.gdk.DROP_START.

Generated during Drag and Drop operations.

gtk.gdk.CLIENT_EVENT

"type"ReadThe event type - see the list below in the Description section
"window"Read/WriteThe gtk.gdk.Window the event occurred on.
"send_event"Read/WriteTrue if the event was sent explicitly.
"message_type"Read/WriteThe type of the message, which can be defined by the application.
"data_format"Read/WriteThe format of the data, given as the number of bits in each data element, i.e. 8, 16, or 32.
"data"Read/WriteThe data as a string of 8-bit characters.

An event sent by another client application.

gtk.gdk.VISIBILITY_NOTIFY

"type"ReadThe event type - see the list below in the Description section
"window"Read/WriteThe gtk.gdk.Window the event occurred on.
"send_event"Read/WriteTrue if the event was sent explicitly.
"state"Read/WriteThe new visibility state (gtk.gdk.VISIBILITY_FULLY_OBSCURED, gtk.gdk.VISIBILITY_PARTIAL or gtk.gdk.VISIBILITY_UNOBSCURED).

Generated when the window visibility status has changed.

gtk.gdk.SCROLL

"type"ReadThe event type - see the list below in the Description section
"window"Read/WriteThe gtk.gdk.Window the event occurred on.
"send_event"Read/WriteTrue if the event was sent explicitly.
"time"Read/WriteThe time of the event in milliseconds.
"x"Read/WriteThe x coordinate of the pointer relative to the window.
"y"Read/WriteThe y coordinate of the pointer relative to the window.
"state"Read/WriteA bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt) and the pointer buttons.
"direction"Read/WriteThe direction to scroll to (one of gtk.gdk.SCROLL_UP, gtk.gdk.SCROLL_DOWN, gtk.gdk.SCROLL_LEFT or gtk.gdk.SCROLL_RIGHT).
"device"ReadThe device where the event originated.
"x_root"Read/WriteThe x coordinate of the pointer relative to the root of the screen.
"y_root"Read/WriteThe y coordinate of the pointer relative to the root of the screen.

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.

gtk.gdk.WINDOW_STATE

"type"ReadThe event type - see the list below in the Description section
"window"Read/WriteThe gtk.gdk.Window the event occurred on.
"send_event"Read/WriteTrue if the event was sent explicitly.
"changed_mask"Read/WriteThe mask specifying what flags have changed - a combination of: gtk.gdk.WINDOW_STATE_WITHDRAWN, gtk.gdk.WINDOW_STATE_ICONIFIED, gtk.gdk.WINDOW_STATE_MAXIMIZED and gtk.gdk.WINDOW_STATE_STICKY
"new_window_state"Read/WriteThe new window state - a combination of: gtk.gdk.WINDOW_STATE_WITHDRAWN, gtk.gdk.WINDOW_STATE_ICONIFIED, gtk.gdk.WINDOW_STATE_MAXIMIZED and gtk.gdk.WINDOW_STATE_STICKY

Generated when the state of a toplevel window changes.

gtk.gdk.SETTING

"type"ReadThe event type - see the list below in the Description section
"window"Read/WriteThe gtk.gdk.Window the event occurred on.
"send_event"Read/WriteTrue if the event was sent explicitly.
"action"Read/WriteWhat happened to the setting (gtk.gdk.SETTING_ACTION_NEW, gtk.gdk.SETTING_ACTION_CHANGED or gtk.gdk.SETTING_ACTION_DELETED).
"name"Read/WriteThe name of the setting.

Generated when a setting is modified.

gtk.gdk.OWNER_CHANGE

Note

This Event type is available in PyGTK 2.8 and above.

"type"ReadThe event type - see the list below in the Description section
"window"Read/WriteThe gtk.gdk.Window the event occurred on.
"send_event"Read/WriteTrue if the event was sent explicitly.
"owner"Read/Writethe new owner of the selection - the native window ID as an integer
"reason"Read/Writethe reason for the ownership change indicated by one of the GDK Owner Change Constants.
"selection"Readthe atom identifying the selection
"time"Read/Writethe timestamp of the event
"selection_time"Read/Writethe time at which the selection ownership was taken over

Generated when the owner of a selection changes. On X11, this information is only available if the X server supports the XFIXES extension.

gtk.gdk.GRAB_BROKEN

Note

This Event type is available in PyGTK 2.8 and above.

"type"ReadThe event type - see the list below in the Description section
"window"Read/WriteThe gtk.gdk.Window the event occurred on.
"send_event"Read/WriteTrue if the event was sent explicitly.
"keyboard"Read/Writeif True a keyboard grab was broken; if False a pointer grab was broken
"implicit"Read/Writeif True the broken grab was implicit
"grab_window"ReadIf this event is caused by another grab in the same application, grab_window contains the new grab window. Otherwise grab_window is None.

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.

Description

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.EXPOSURE_MASK
  • gtk.gdk.POINTER_MOTION_MASK
  • gtk.gdk.POINTER_MOTION_HINT_MASK
  • gtk.gdk.BUTTON_MOTION_MASK
  • gtk.gdk.BUTTON1_MOTION_MASK
  • gtk.gdk.BUTTON2_MOTION_MASK
  • gtk.gdk.BUTTON3_MOTION_MASK
  • gtk.gdk.BUTTON_PRESS_MASK
  • gtk.gdk.BUTTON_RELEASE_MASK
  • gtk.gdk.KEY_PRESS_MASK
  • gtk.gdk.KEY_RELEASE_MASK
  • gtk.gdk.ENTER_NOTIFY_MASK
  • gtk.gdk.LEAVE_NOTIFY_MASK
  • gtk.gdk.FOCUS_CHANGE_MASK
  • gtk.gdk.STRUCTURE_MASK
  • gtk.gdk.PROPERTY_CHANGE_MASK
  • gtk.gdk.VISIBILITY_NOTIFY_MASK
  • gtk.gdk.PROXIMITY_IN_MASK
  • gtk.gdk.PROXIMITY_OUT_MASK
  • gtk.gdk.SUBSTRUCTURE_MASK
  • gtk.gdk.SCROLL_MASK
  • gtk.gdk.ALL_EVENTS_MASK

gtk.gdk.ALL_EVENTS_MASK is a combination of all the event masks.

Starting with PyGTK 2.14 gtk.gdk.Event objects have custom support for repr Python function. Text representation will include event type and a few most important event attributes, e.g. x, y and button for gtk.gdk.BUTTON_PRESS events. However, round-tripping through eval(repr(event)) is not possible: representation string uses <...> form.

Constructor

    gtk.gdk.Event(type)

type :

a event type - see the Description above

Returns :

a newly-allocated gtk.gdk.Event.

Note

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.

Methods

gtk.gdk.Event.put

    def put()

The put() method appends a copy of the given event onto the tail of the event queue.

gtk.gdk.Event.copy

    def copy()

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).

gtk.gdk.Event.free

    def free()

Warning

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().

gtk.gdk.Event.get_time

    def get_time()

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.

gtk.gdk.Event.get_state

    def get_state()

Returns :

the modifier state

Note

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.

gtk.gdk.NOTHING

These events do not have any additional attributes.

gtk.gdk.Event.get_coords

    def get_coords()

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.

gtk.gdk.Event.get_root_coords

    def get_root_coords()

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.

gtk.gdk.Event.get_axis

    def get_axis(axis_use)

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.

gtk.gdk.Event.set_screen

    def set_screen(screen)

screen :

a gtk.gdk.Screen

Note

This method is available in PyGTK 2.2 and above.

The set_screen() method sets the gtk.gdk.Screen to the value of screen. The event must have been allocated by PyGTK, for instance, by the gtk.gdk.Event.copy() method.

gtk.gdk.Event.get_screen

    def get_screen()

Returns :

the screen for the event

Note

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.

Functions

gtk.gdk.events_pending

    def gtk.gdk.events_pending()

Returns :

True if any events are pending

The gtk.gdk.events_pending() function returns True if any events are ready to be processed.

gtk.gdk.event_peek

    def gtk.gdk.event_peek()

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.

gtk.gdk.event_get

    def gtk.gdk.event_get()

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.

gtk.gdk.event_get_graphics_expose

    def gtk.gdk.event_get_graphics_expose(window)

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.

gtk.gdk.set_show_events

    def gtk.gdk.set_show_events(show_events)

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.

gtk.gdk.get_show_events

    def gtk.gdk.get_show_events()

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.

gtk.gdk.event_handler_set

    def gtk.gdk.event_handler_set(func, data=None)

func :

the function to call to handle events from GDK or None.

data :

user data to pass to the function.

Note

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.

gtk.gdk.event_request_motions

    def gtk.gdk.event_request_motions(event)

event :

a valid gtk.gdk.Event

Note

This function is available in PyGTK 2.12 and above.

The gtk.gdk.event_request_motions() function request more motion notifies if event is a motion notify hint event. This function should be used instead of gtk.gdk.Window.get_pointer() to request further motion notifies, because it also works for extension events where motion notifies are provided for devices other than the core pointer.