gtk.gdk.Event — an object representing an event from the windowing system
class gtk.gdk.Event(gobject.GBoxed): |
Functions |
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.
The following attributes are available to all different kind of 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 |
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.
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. The returned gtk.gdk.Event should be freed with gtk.gdk.Event.free(). |
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). The new gtk.gdk.Event must be freed with the free() method.
|
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:
gtk.gdk.SHIFT_MASK | The Shift key. |
gtk.gdk.LOCK_MASK | A Lock key (depending on the modifier mapping of the X server this may either be CapsLock or ShiftLock). |
gtk.gdk.CONTROL_MASK | The Control key. |
gtk.gdk.MOD1_MASK | The fourth modifier key (it depends on the modifier mapping of the X server which key is interpreted as this modifier, but normally it is the Alt key). |
gtk.gdk.MOD2_MASK | The fifth modifier key (it depends on the modifier mapping of the X server which key is interpreted as this modifier). |
gtk.gdk.MOD3_MASK | The sixth modifier key (it depends on the modifier mapping of the X server which key is interpreted as this modifier). |
gtk.gdk.MOD4_MASK | The seventh modifier key (it depends on the modifier mapping of the X server which key is interpreted as this modifier). |
gtk.gdk.MOD5_MASK | The eighth modifier key (it depends on the modifier mapping of the X server which key is interpreted as this modifier). |
gtk.gdk.BUTTON1_MASK | The first mouse button. |
gtk.gdk.BUTTON2_MASK | The second mouse button. |
gtk.gdk.BUTTON3_MASK | The third mouse button. |
gtk.gdk.BUTTON4_MASK | The fourth mouse button. |
gtk.gdk.BUTTON5_MASK | The fifth mouse button. |
gtk.gdk.RELEASE_MASK | Differentiates between (keyval, modifiers) pairs from key press and release events. |
gtk.gdk.MODIFIER_MASK | all of the above |
These events does 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.
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.
|
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. The returned gtk.gdk.Event should be freed with the free() method.
|
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. The returned gtk.gdk.Event should be freed using the free() method.
|
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.