/usr/share/doc/python-gtk2-tutorial/html/sec-Events.html is in python-gtk2-tutorial 2.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>2.3. Events</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="PyGTK 2.0 Tutorial"><link rel="up" href="ch-GettingStarted.html" title="Chapter 2. Getting Started"><link rel="previous" href="sec-TheoryOfSignalsAndCallbacks.html" title="2.2. Theory of Signals and Callbacks"><link rel="next" href="sec-SteppingThroughHelloWorld.html" title="2.4. Stepping Through Hello World"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">2.3. Events</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="sec-TheoryOfSignalsAndCallbacks.html">Prev</a> </td><th width="60%" align="center">Chapter 2. Getting Started</th><td width="20%" align="right"> <a accesskey="n" href="sec-SteppingThroughHelloWorld.html">Next</a></td></tr></table><hr></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sec-Events"></a>2.3. Events</h2></div></div><div></div></div><p>In addition to the signal mechanism described above, there is a
set of events that reflect the X event mechanism. Callbacks may also be
attached to these events. These events are:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
event
button_press_event
button_release_event
scroll_event
motion_notify_event
delete_event
destroy_event
expose_event
key_press_event
key_release_event
enter_notify_event
leave_notify_event
configure_event
focus_in_event
focus_out_event
map_event
unmap_event
property_notify_event
selection_clear_event
selection_request_event
selection_notify_event
proximity_in_event
proximity_out_event
visibility_notify_event
client_event
no_expose_event
window_state_event
</pre></td></tr></table><p>In order to connect a callback function to one of these events
you use the method <tt class="methodname">connect</tt>() , as described above,
using one of the above event names as the <i class="parameter"><tt>name</tt></i> parameter.
The callback function (or method) for events has a slightly different form
than that for signals:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
def callback_func(widget, event, callback_data ):
def callback_meth(self, widget, event, callback_data ):
</pre></td></tr></table><p><tt class="classname">GdkEvent</tt> is a python object type whose
type attribute will indicate which of the above events has occurred. The
other attributes of the event will depend upon the type of the event.
Possible values for the types are:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
NOTHING
DELETE
DESTROY
EXPOSE
MOTION_NOTIFY
BUTTON_PRESS
_2BUTTON_PRESS
_3BUTTON_PRESS
BUTTON_RELEASE
KEY_PRESS
KEY_RELEASE
ENTER_NOTIFY
LEAVE_NOTIFY
FOCUS_CHANGE
CONFIGURE
MAP
UNMAP
PROPERTY_NOTIFY
SELECTION_CLEAR
SELECTION_REQUEST
SELECTION_NOTIFY
PROXIMITY_IN
PROXIMITY_OUT
DRAG_ENTER
DRAG_LEAVE
DRAG_MOTION
DRAG_STATUS
DROP_START
DROP_FINISHED
CLIENT_EVENT
VISIBILITY_NOTIFY
NO_EXPOSE
SCROLL
WINDOW_STATE
SETTING
</pre></td></tr></table><p>These values are accessed by prefacing the event type with
gtk.gdk. for example <tt class="varname">gtk.gdk.DRAG_ENTER</tt>.</p><p>So, to connect a callback function to one of these events we
would use something like:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
button.connect("button_press_event", button_press_callback)
</pre></td></tr></table><p>This assumes that button is a <tt class="classname">GtkButton</tt>
widget. Now, when the mouse is over the button and a mouse button is
pressed, the function <i class="parameter"><tt>button_press_callback</tt></i> will be
called. This function may be defined as:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
def button_press_callback(widget, event, data ):
</pre></td></tr></table><p>The value returned from this function indicates whether the
event should be propagated further by the GTK+ event handling mechanism.
Returning <tt class="varname">True</tt> indicates that the event has been
handled, and that it should not propagate further. Returning
<tt class="varname">False</tt> continues the normal event handling. See <a href="ch-AdvancedEventAndSignalHandling.html" title="Chapter 20. Advanced Event and Signal Handling">Chapter 20, <i>Advanced Event and Signal Handling</i></a> for more details on this
propagation process.</p><p>The GDK selection and drag-and-drop APIs also emit a number of
events which are reflected in GTK+ by signals. See <a href="sec-DNDMethods.html#sec-SignalsOnSourceWidget" title="22.3.2. Signals On the Source Widget">Section 22.3.2, “Signals On the Source Widget”</a> and <a href="sec-DNDMethods.html#sec-SignalsOnDestinationWidget" title="22.3.4. Signals On the Destination Widget">Section 22.3.4, “Signals On the Destination Widget”</a> for details on the
signatures of the callback functions for these signals:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
selection_received
selection_get
drag_begin_event
drag_end_event
drag_data_delete
drag_motion
drag_drop
drag_data_get
drag_data_received
</pre></td></tr></table></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="sec-TheoryOfSignalsAndCallbacks.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch-GettingStarted.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="sec-SteppingThroughHelloWorld.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2.2. Theory of Signals and Callbacks </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 2.4. Stepping Through Hello World</td></tr></table></div></body></html>
|