|
class gtk.gdk.Event(gobject.GBoxed): |
Functionsdef 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
)
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
|
Contain only the fields that are common to all event types.
gtk.gdk.EXPOSE
|
Generated when all or part of a window becomes visible and needs to be redrawn.
gtk.gdk.MOTION_NOTIFY
|
Generated when the pointer moves.
gtk.gdk.BUTTON_PRESS
|
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:
gtk.gdk.BUTTON_PRESS
gtk.gdk.BUTTON_RELEASE
gtk.gdk.BUTTON_PRESS
gtk.gdk._2BUTTON_PRESS
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:
gtk.gdk.BUTTON_PRESS
gtk.gdk.BUTTON_RELEASE
gtk.gdk.BUTTON_PRESS
gtk.gdk._2BUTTON_PRESS
gtk.gdk.BUTTON_RELEASE
gtk.gdk.BUTTON_PRESS
gtk.gdk._3BUTTON_PRESS
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
|
Generated for a key press or key release event.
gtk.gdk.ENTER_NOTIFY
|
Generated when the pointer enters or leaves a window.
gtk.gdk.FOCUS_CHANGE
|
Describes a change of keyboard focus.
gtk.gdk.CONFIGURE
|
Generated when a window size or position has changed.
gtk.gdk.PROPERTY_NOTIFY
|
Describes a property change on a window.
gtk.gdk.SELECTION_CLEAR
|
Generated when a selection is requested or ownership of a selection is taken over by another client application.
gtk.gdk.PROXIMITY_IN
|
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
|
Generated during Drag and Drop operations.
gtk.gdk.CLIENT_EVENT
|
An event sent by another client application.
gtk.gdk.VISIBILITY_NOTIFY
|
Generated when the window visibility status has changed.
gtk.gdk.SCROLL
|
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
|
Generated when the state of a toplevel window changes.
gtk.gdk.SETTING
|
Generated when a setting is modified.
gtk.gdk.OWNER_CHANGE
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.
gtk.gdk.GRAB_BROKEN
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:
| a special code to indicate a null event. |
| 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. |
| the window has been destroyed. |
| all or part of the window has become visible and needs to be redrawn. |
| the pointer (usually a mouse) has moved. |
| a mouse button has been pressed. |
| 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. |
| 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. |
| a mouse button has been released. |
| a key has been pressed. |
| a key has been released. |
| the pointer has entered the window. |
| the pointer has left the window. |
| the keyboard focus has entered or left the window. |
| the size, position or stacking order of the window has changed. Note that PyGTK discards these events for gtk.gdk.WINDOW_CHILD windows. |
| the window has been mapped. |
| the window has been unmapped. |
| a property on the window has been changed or deleted. |
| the application has lost ownership of a selection. |
| another application has requested a selection. |
| a selection has been received. |
| an input device has moved into contact with a sensing surface (e.g. a touchscreen or graphics tablet). |
| an input device has moved out of contact with a sensing surface. |
| the mouse has entered the window while a drag is in progress. |
| the mouse has left the window while a drag is in progress |
| the mouse has moved in the window while a drag is in progress. |
| the status of the drag operation initiated by the window has changed. |
| a drop operation onto the window has started. |
| the drop operation initiated by the window has completed. |
| a message has been received from another application. |
| the window visibility status has changed. |
| indicates that the source region was completely available when parts of a drawable were copied. This is not very useful. |
| a scroll had occurred for a window |
| the window state has changed |
| a setting has changed |
| the owner of a selection has changed. Added in GTK+ 2.6 |
| 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.
gtk.gdk.Event(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.
def put()
The put
() method appends a copy of the
given event onto the tail of the event queue.
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).
def free()
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
().
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.
def get_state()
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.
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.
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.
def get_axis(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:
| the axis is ignored. |
| the axis is used as the x axis. |
| the axis is used as the y axis. |
| the axis is used for pressure information. |
| the axis is used for x tilt information. |
| the axis is used for y tilt information. |
| the axis is used for wheel information. |
| a constant equal to the numerically highest axis value. |
If an axis with the specified axis use is not found, this method
returns None
.
def set_screen(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.
def get_screen()
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.
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.
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.
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.
def gtk.gdk.event_get_graphics_expose(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.
def gtk.gdk.set_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.
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.
def gtk.gdk.event_handler_set(func
, data
=None)
| the function to call to handle events from GDK
or None . |
| 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
.
def gtk.gdk.event_request_motions(event
)
| a valid gtk.gdk.Event
|
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.
© manpagez.com 2000-2024 Individual documents may contain additional copyright information.