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 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
|
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>gtk.gdk.Keymap</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="PyGTK 2.0 Reference Manual"><link rel="up" href="gdk-class-reference.html" title="The gtk.gdk Class Reference"><link rel="previous" href="class-gdkimage.html" title="gtk.gdk.Image"><link rel="next" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"></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">gtk.gdk.Keymap</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-gdkimage.html">Prev</a></td><th width="60%" align="center">The gtk.gdk Class Reference</th><td width="20%" align="right"><a accesskey="n" href="class-gdkpixbuf.html">Next</a></td></tr></table><hr></div><div class="refentry" lang="en"><a name="class-gdkkeymap"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2>gtk.gdk.Keymap</h2><p>gtk.gdk.Keymap — an object containing mappings of keys to key
values.</p></div><div class="refsect1" lang="en"><a name="id3019281"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gtk.gdk.Keymap</span></span>(<span class="ooclass"><span class="classname"><a href="class-gobject.html" title="gobject.GObject">gobject.GObject</a></span></span>):
<code class="methodsynopsis"> def <span class="methodname"><a href="class-gdkkeymap.html#method-gdkkeymap--lookup-key" title="gtk.gdk.Keymap.lookup_key">lookup_key</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>keycode</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>group</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>level</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gdkkeymap.html#method-gdkkeymap--translate-keyboard-state" title="gtk.gdk.Keymap.translate_keyboard_state">translate_keyboard_state</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>keycode</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>state</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>group</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gdkkeymap.html#method-gdkkeymap--get-entries-for-keyval" title="gtk.gdk.Keymap.get_entries_for_keyval">get_entries_for_keyval</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>keyval</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gdkkeymap.html#method-gdkkeymap--get-entries-for-keycode" title="gtk.gdk.Keymap.get_entries_for_keycode">get_entries_for_keycode</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>hardware_keycode</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gdkkeymap.html#method-gdkkeymap--get-direction" title="gtk.gdk.Keymap.get_direction">get_direction</a></span>(<span class="methodparam"></span>)</code><br></pre></td></tr></table><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
<span class="bold"><b>Functions</b></span>
<code class="methodsynopsis"> def <span class="methodname"><a href="class-gdkkeymap.html#function-gdk--keymap-get-default" title="gtk.gdk.keymap_get_default">gtk.gdk.keymap_get_default</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gdkkeymap.html#function-gdk--keymap-get-for-display" title="gtk.gdk.keymap_get_for_display">gtk.gdk.keymap_get_for_display</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>display</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gdkkeymap.html#function-gdk--keyval-name" title="gtk.gdk.keyval_name">gtk.gdk.keyval_name</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>keyval</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gdkkeymap.html#function-gdk--keyval-from-name" title="gtk.gdk.keyval_from_name">gtk.gdk.keyval_from_name</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>keyval_name</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gdkkeymap.html#function-gdk--keyval-convert-case" title="gtk.gdk.keyval_convert_case">gtk.gdk.keyval_convert_case</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>symbol</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gdkkeymap.html#function-gdk--keyval-to-upper" title="gtk.gdk.keyval_to_upper">gtk.gdk.keyval_to_upper</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>keyval</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gdkkeymap.html#function-gdk--keyval-to-lower" title="gtk.gdk.keyval_to_lower">gtk.gdk.keyval_to_lower</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>keyval</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gdkkeymap.html#function-gdk--keyval-is-upper" title="gtk.gdk.keyval_is_upper">gtk.gdk.keyval_is_upper</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>keyval</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gdkkeymap.html#function-gdk--keyval-is-lower" title="gtk.gdk.keyval_is_lower">gtk.gdk.keyval_is_lower</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>keyval</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gdkkeymap.html#function-gdk--keyval-to-unicode" title="gtk.gdk.keyval_to_unicode">gtk.gdk.keyval_to_unicode</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>keyval</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gdkkeymap.html#function-gdk--unicode-to-keyval" title="gtk.gdk.unicode_to_keyval">gtk.gdk.unicode_to_keyval</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>wc</tt></b></span></span>)</code></pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id3000991"></a><h2>Ancestry</h2><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="synopsis">+-- <a href="class-gobject.html" title="gobject.GObject">gobject.GObject</a>
+-- <a href="class-gdkkeymap.html" title="gtk.gdk.Keymap">gtk.gdk.Keymap</a>
</pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id3013780"></a><h2>Signal Prototypes</h2><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term">"<a href="class-gdkkeymap.html#signal-gdkkeymap--direction-changed" title='The "direction-changed" gtk.gdk.Keymap Signal'>direction-changed</a>"</span></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><i class="parameter"><tt>gdkkeymap</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>user_param1</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>...</tt></i></span></span>)</code></td></tr><tr><td><span class="term">"<a href="class-gdkkeymap.html#signal-gdkkeymap--keys-changed" title='The "keys-changed" gtk.gdk.Keymap Signal'>keys-changed</a>"</span></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><i class="parameter"><tt>gdkkeymap</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>user_param1</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>...</tt></i></span></span>)</code></td></tr></tbody></table></div><div class="refsect1" lang="en"><a name="id3220003"></a><h2>Description</h2><p>A <a href="class-gdkkeymap.html" title="gtk.gdk.Keymap"><tt class="classname">gtk.gdk.Keymap</tt></a>
defines the translation from keyboard state (including a hardware key, a
modifier mask, and active keyboard group) to a keyval. This translation has
two phases. The first phase is to determine the effective keyboard group and
level for the keyboard state; the second phase is to look up the
keycode/group/level triplet in the keymap and see what keyval it corresponds
to. One <a href="class-gdkkeymap.html" title="gtk.gdk.Keymap"><tt class="classname">gtk.gdk.Keymap</tt></a>
object exists for each user display. <tt class="literal">PyGTK</tt> supports only
one display, so <a href="class-gdkkeymap.html#function-gdk--keymap-get-default" title="gtk.gdk.keymap_get_default"><tt class="function">gtk.gdk.keymap_get_default()</tt>()</a>
returns the singleton <a href="class-gdkkeymap.html" title="gtk.gdk.Keymap"><tt class="classname">gtk.gdk.Keymap</tt></a>.</p><p>A keymap is a mapping from a Keymap key to key values. You can
think of a Keymap key as a representation of a symbol printed on a physical
keyboard key. That is, it contains three pieces of information. First, it
contains the hardware keycode; this is an identifying number for a physical
key. Second, it contains the level of the key. The level indicates which
symbol on the key will be used, in a vertical direction. So on a standard US
keyboard, the key with the number "1" on it also has the exclamation point
("!") character on it. The level indicates whether to use the "1" or the "!"
symbol. The letter keys are considered to have a lowercase letter at level
0, and an uppercase letter at level 1, though only the uppercase letter is
printed. Third, the Keymap key contains a group; groups are not used on
standard US keyboards, but are used in many other countries. On a keyboard
with groups, there can be 3 or 4 symbols printed on a single key. The group
indicates movement in a horizontal direction. Usually groups are used for
two different languages. In group 0, a key might have two English
characters, and in group 1 it might have two Hebrew characters. The Hebrew
characters will be printed on the key next to the English characters.
</p></div><div class="refsect1" lang="en"><a name="id2965849"></a><h2>Methods</h2><div class="refsect2" lang="en"><a name="method-gdkkeymap--lookup-key"></a><h3>gtk.gdk.Keymap.lookup_key</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">lookup_key</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>keycode</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>group</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>level</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>keycode</tt></b>:</span></td><td>the hardware keycode.</td></tr><tr><td><span class="term"><b class="parameter"><tt>group</tt></b>:</span></td><td>the key group</td></tr><tr><td><span class="term"><b class="parameter"><tt>level</tt></b>:</span></td><td>the key level</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a keyval, or 0 if none was mapped to the
(<i class="parameter"><tt>keycode</tt></i>, <i class="parameter"><tt>group</tt></i>,
<i class="parameter"><tt>level</tt></i>) triplet.</td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.4 and above.</p></div><p>The <tt class="methodname">lookup_key</tt>() method returns the
keyval mapped to the specified (<i class="parameter"><tt>keycode</tt></i>,
<i class="parameter"><tt>group</tt></i>, <i class="parameter"><tt>level</tt></i>) triplet. This
method returns 0 if no keyval is found. For normal user input, you want to
use the <a href="class-gdkkeymap.html#method-gdkkeymap--translate-keyboard-state" title="gtk.gdk.Keymap.translate_keyboard_state"><tt class="methodname">translate_keyboard_state()</tt></a>
method instead of this method, since the effective group or level may not be
the same as the current keyboard state.</p><p>The parameters to this method are:</p><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><i class="parameter"><tt>keycode</tt></i>:</span></td><td>the hardware keycode. This is an identifying number for
a physical key.</td></tr><tr><td><span class="term"><i class="parameter"><tt>group</tt></i>:</span></td><td>indicates movement in a horizontal direction. Usually
groups are used for two different languages. In group 0, a key might have
two English characters, and in group 1 it might have two Hebrew
characters. The Hebrew characters will be printed on the key next to the
English characters.</td></tr><tr><td><span class="term"><i class="parameter"><tt>level</tt></i>:</span></td><td>indicates which symbol on the key will be used, in a
vertical direction. So on a standard US keyboard, the key with the number
"1" on it also has the exclamation point ("!") character on it. The level
indicates whether to use the "1" or the "!" symbol. The letter keys are
considered to have a lowercase letter at level 0, and an uppercase letter at
level 1, though only the uppercase letter is printed.</td></tr></tbody></table><p></p></div><div class="refsect2" lang="en"><a name="method-gdkkeymap--translate-keyboard-state"></a><h3>gtk.gdk.Keymap.translate_keyboard_state</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">translate_keyboard_state</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>keycode</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>state</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>group</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>keycode</tt></b>:</span></td><td>a keycode</td></tr><tr><td><span class="term"><b class="parameter"><tt>state</tt></b>:</span></td><td>a modifier state</td></tr><tr><td><span class="term"><b class="parameter"><tt>group</tt></b>:</span></td><td>an active keyboard group</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a 4-tuple containing the keyval, the effective group,
the level and the modifiers that were used to determine the group or
level</td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.4 and above.</p></div><p>The <tt class="methodname">translate_keyboard_state</tt>() method
translates the contents of a keyboard <a href="class-gdkevent.html" title="gtk.gdk.Event"><tt class="classname">gtk.gdk.Event</tt></a>
(specified by <i class="parameter"><tt>keycode</tt></i>, <i class="parameter"><tt>state</tt></i>
and <i class="parameter"><tt>group</tt></i>) into a keyval, effective group, level and
consumed modifiers that affected the translation (and are unavailable for
application use) which are returned in a 4-tuple. See the <a href="class-gdkkeymap.html#method-gdkkeymap--lookup-key" title="gtk.gdk.Keymap.lookup_key"><tt class="methodname">lookup_key</tt>()</a>
method for an explanation of groups and levels. The effective group is the
group that was actually used for the translation; some keys such as
<span><b class="keycap">Enter</b></span> are not affected by the active keyboard group. The
level is derived from <i class="parameter"><tt>state</tt></i>. For convenience, the
keyboard <a href="class-gdkevent.html" title="gtk.gdk.Event"><tt class="classname">gtk.gdk.Event</tt></a> already
contains the translated keyval, so this method isn't as useful as you might
think.</p><p>The value of <i class="parameter"><tt>state</tt></i> or the consumed
modifiers is a combination of:</p><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><tt class="literal">gtk.gdk.SHIFT_MASK</tt></span></td><td>The Shift key.</td></tr><tr><td><span class="term"><tt class="literal">gtk.gdk.LOCK_MASK</tt></span></td><td>A Lock key (depending on the modifier mapping of the X
server this may either be CapsLock or ShiftLock).</td></tr><tr><td><span class="term"><tt class="literal">gtk.gdk.CONTROL_MASK</tt></span></td><td>The Control key. </td></tr><tr><td><span class="term"><tt class="literal">gtk.gdk.MOD1_MASK</tt></span></td><td>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).</td></tr><tr><td><span class="term"><tt class="literal">gtk.gdk.MOD2_MASK</tt></span></td><td>The fifth modifier key (it depends on the modifier
mapping of the X server which key is interpreted as this
modifier).</td></tr><tr><td><span class="term"><tt class="literal">gtk.gdk.MOD3_MASK</tt></span></td><td>The sixth modifier key (it depends on the modifier
mapping of the X server which key is interpreted as this
modifier).</td></tr><tr><td><span class="term"><tt class="literal">gtk.gdk.MOD4_MASK</tt></span></td><td>The seventh modifier key (it depends on the modifier
mapping of the X server which key is interpreted as this
modifier).</td></tr><tr><td><span class="term"><tt class="literal">gtk.gdk.MOD5_MASK</tt></span></td><td>The eighth modifier key (it depends on the modifier
mapping of the X server which key is interpreted as this
modifier).</td></tr><tr><td><span class="term"><tt class="literal">gtk.gdk.BUTTON1_MASK</tt></span></td><td>The first mouse button.</td></tr><tr><td><span class="term"><tt class="literal">gtk.gdk.BUTTON2_MASK</tt></span></td><td>The second mouse button.</td></tr><tr><td><span class="term"><tt class="literal">gtk.gdk.BUTTON3_MASK</tt></span></td><td>The third mouse button.</td></tr><tr><td><span class="term"><tt class="literal">gtk.gdk.BUTTON4_MASK</tt></span></td><td>The fourth mouse button.</td></tr><tr><td><span class="term"><tt class="literal">gtk.gdk.BUTTON5_MASK</tt></span></td><td>The fifth mouse button.</td></tr><tr><td><span class="term"><tt class="literal">gtk.gdk.RELEASE_MASK</tt></span></td><td>Differentiates between (keyval, modifiers) pairs from
key press and release events.</td></tr><tr><td><span class="term"><tt class="literal">gtk.gdk.MODIFIER_MASK</tt></span></td><td>all of the above</td></tr></tbody></table><p></p><div class="refsect3" lang="en"><a name="id3031145"></a><h4>Consumed Modifiers</h4><p>The consumed_modifiers are modifiers that should be masked out
from state when comparing this key press to a hot key. For instance, on a US
keyboard, the <span class="keysym">plus</span> symbol is shifted, so when comparing a key press to a
<span><b class="keycap">Control</b></span>-<span class="keysym">plus</span>
accelerator <span><b class="keycap">Shift</b></span> should be masked out. For
example:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
# We want to ignore irrelevant modifiers like ScrollLock
ALL_ACCELS_MASK = (gtk.gdk.CONTROL_MASK | gtk.gdk.SHIFT_MASK
| gtk.gdk.MOD1_MASK)
keyval, egroup, level, consumed = keymap.translate_keyboard_state(
keymap, event.hardware_keycode, event.state, event.group)
if (keyval == ord('+') and
(event.state & ~consumed & ALL_ACCELS_MASK) == gtk.gdk.CONTROL_MASK):
# Control was pressed
</pre></td></tr></table><p>All single modifier combinations that could affect the key for
any combination of modifiers will be returned in consumed_modifiers.
Multi-modifier combinations are returned only when actually found in
<i class="parameter"><tt>state</tt></i>. When you store accelerators, you should always
store them with consumed modifiers removed. Store <Control>plus, not
<Control><Shift>plus,</p></div></div><div class="refsect2" lang="en"><a name="method-gdkkeymap--get-entries-for-keyval"></a><h3>gtk.gdk.Keymap.get_entries_for_keyval</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_entries_for_keyval</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>keyval</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>keyval</tt></b>:</span></td><td>a keyval, such as <tt class="literal">GDK_a</tt>,
<tt class="literal">GDK_Up</tt>, <tt class="literal">GDK_Return</tt>,
etc.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a tuple containing 3-tuple containing a keycode,
a group and a level that will generate
<i class="parameter"><tt>keyval</tt></i>.</td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.4 and above.</p></div><p>The <tt class="methodname">get_entries_for_keyval</tt>() method
returns a tuple of (keycode, group, level) 3-tuples that will generate
<i class="parameter"><tt>keyval</tt></i>. Groups and levels are two kinds of keyboard
mode; in general, the level determines whether the top or bottom symbol on a
key is used, and the group determines whether the left or right symbol is
used. On US keyboards, the shift key changes the keyboard level, and there
are no groups. A group switch key might convert a keyboard between Hebrew to
English modes, for example, the <tt class="literal">gtk.gdk.KEY_PRESS</tt> and
<tt class="literal">gtk.gdk.KEY_RELEASE</tt> <a href="class-gdkevent.html" title="gtk.gdk.Event"><tt class="classname">gtk.gdk.Event</tt></a> objects
contain a <tt class="literal">group</tt> attribute that indicates the active
keyboard group. The level is computed from the modifier mask.</p></div><div class="refsect2" lang="en"><a name="method-gdkkeymap--get-entries-for-keycode"></a><h3>gtk.gdk.Keymap.get_entries_for_keycode</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_entries_for_keycode</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>hardware_keycode</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>hardware_keycode</tt></b>:</span></td><td>a keycode</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a tuple containing 4-tuples: (keyval, keycode,
group, level)</td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.4 and above.</p></div><p>The <tt class="methodname">get_entries_for_keycode</tt>() method
returns a tuple containing 4-tuples with: the keyvals bound to
<i class="parameter"><tt>hardware_keycode</tt></i>, the keycode, the group and the
level. When a keycode is pressed by the user, the keyval from this list of
entries is selected by considering the effective keyboard group and
level. See the <a href="class-gdkkeymap.html#method-gdkkeymap--translate-keyboard-state" title="gtk.gdk.Keymap.translate_keyboard_state"><tt class="methodname">translate_keyboard_state()</tt></a>
method for more information.</p></div><div class="refsect2" lang="en"><a name="method-gdkkeymap--get-direction"></a><h3>gtk.gdk.Keymap.get_direction</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_direction</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a Pango direction: <tt class="literal">pango.DIRECTION_LTR</tt> or <tt class="literal">pango.DIRECTION_RTL</tt>.</td></tr></tbody></table><p>The <tt class="methodname">get_direction</tt>() method returns the direction of the keymap.</p></div></div><div class="refsect1" lang="en"><a name="id3204646"></a><h2>Functions</h2><div class="refsect2" lang="en"><a name="function-gdk--keymap-get-default"></a><h3>gtk.gdk.keymap_get_default</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">gtk.gdk.keymap_get_default</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>the default gdk keymap for the
display.</td></tr></tbody></table><p>The <tt class="function">gtk.gdk.keymap_get_default</tt>() function
returns the default <a href="class-gdkkeymap.html" title="gtk.gdk.Keymap"><tt class="classname">gtk.gdk.Keymap</tt></a> for
the display.</p></div><div class="refsect2" lang="en"><a name="function-gdk--keymap-get-for-display"></a><h3>gtk.gdk.keymap_get_for_display</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">gtk.gdk.keymap_get_for_display</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>display</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>display</tt></b>:</span></td><td>a <a href="class-gdkdisplay.html" title="gtk.gdk.Display"><tt class="classname">gtk.gdk.Display</tt></a></td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>the keymap for
<i class="parameter"><tt>display</tt></i>.</td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This function is available in PyGTK 2.2 and above.</p></div><p>The <tt class="function">gtk.gdk.keymap_get_for_display</tt>()
function returns the <a href="class-gdkkeymap.html" title="gtk.gdk.Keymap"><tt class="classname">gtk.gdk.Keymap</tt></a> for
the <a href="class-gdkdisplay.html" title="gtk.gdk.Display"><tt class="classname">gtk.gdk.Display</tt></a>
specified by <i class="parameter"><tt>display</tt></i>.</p></div><div class="refsect2" lang="en"><a name="function-gdk--keyval-name"></a><h3>gtk.gdk.keyval_name</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">gtk.gdk.keyval_name</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>keyval</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>keyval</tt></b>:</span></td><td>a key value</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a string containing the name of the key, or
None if keyval is not a valid key.</td></tr></tbody></table><p>The <tt class="function">gtk.gdk.keyval_name</tt>() function converts
the key value specified by <i class="parameter"><tt>keyval</tt></i> into a symbolic
name.</p></div><div class="refsect2" lang="en"><a name="function-gdk--keyval-from-name"></a><h3>gtk.gdk.keyval_from_name</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">gtk.gdk.keyval_from_name</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>keyval_name</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>keyval_name</tt></b>:</span></td><td>a key name</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>the corresponding key value or 0 if the key
name is not a valid key.</td></tr></tbody></table><p>The <tt class="function">gtk.gdk.keyval_from_name</tt>() function
converts the key name specified by <i class="parameter"><tt>keyval_name</tt></i> to a
key value.</p></div><div class="refsect2" lang="en"><a name="function-gdk--keyval-convert-case"></a><h3>gtk.gdk.keyval_convert_case</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">gtk.gdk.keyval_convert_case</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>symbol</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>symbol</tt></b>:</span></td><td>a keyval</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a 2-tuple containing the lowercase and
uppercase versions of
<i class="parameter"><tt>symbol</tt></i></td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This function is available in PyGTK 2.4 and above.</p></div><p>The <tt class="function">gtk.gdk.keyval_convert_case</tt>() function
returns the lowercase and uppercase versions of the keyval specified by
<i class="parameter"><tt>symbol</tt></i>.</p></div><div class="refsect2" lang="en"><a name="function-gdk--keyval-to-upper"></a><h3>gtk.gdk.keyval_to_upper</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">gtk.gdk.keyval_to_upper</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>keyval</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>keyval</tt></b>:</span></td><td>a key value.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>the upper case form of keyval, or keyval itself
if it is already in upper case or it is not subject to case
conversion.</td></tr></tbody></table><p>The <tt class="function">gtk.gdk.keyval_to_upper</tt>() function
converts the key value specified by <i class="parameter"><tt>keyval</tt></i> to upper
case, if applicable.</p></div><div class="refsect2" lang="en"><a name="function-gdk--keyval-to-lower"></a><h3>gtk.gdk.keyval_to_lower</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">gtk.gdk.keyval_to_lower</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>keyval</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>keyval</tt></b>:</span></td><td>the key value</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>the lower case form of keyval, or keyval itself
if it is already in lower case or it is not subject to case
conversion.</td></tr></tbody></table><p>The <tt class="function">gtk.gdk.keyval_to_lower</tt>() function
converts the key value specified by <i class="parameter"><tt>keyval</tt></i> to lower
case, if applicable. </p></div><div class="refsect2" lang="en"><a name="function-gdk--keyval-is-upper"></a><h3>gtk.gdk.keyval_is_upper</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">gtk.gdk.keyval_is_upper</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>keyval</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>keyval</tt></b>:</span></td><td>the key value</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td><tt class="literal">TRUE</tt> if
<i class="parameter"><tt>keyval</tt></i> is in upper case or if keyval is not subject
to case conversion.</td></tr></tbody></table><p>The <tt class="function">gtk.gdk.keyval_is_upper</tt>() function
returns <tt class="literal">TRUE</tt> if the key value specified by
<i class="parameter"><tt>keyval</tt></i> is in upper case or not subject to case
conversion.</p></div><div class="refsect2" lang="en"><a name="function-gdk--keyval-is-lower"></a><h3>gtk.gdk.keyval_is_lower</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">gtk.gdk.keyval_is_lower</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>keyval</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>keyval</tt></b>:</span></td><td>the key value</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td><tt class="literal">TRUE</tt> if
<i class="parameter"><tt>keyval</tt></i> is in lower case, or if
<i class="parameter"><tt>keyval</tt></i> is not subject to case
conversion.</td></tr></tbody></table><p>The <tt class="function">gtk.gdk.keyval_is_lower</tt>() function
returns <tt class="literal">TRUE</tt> if the key value specified by
<i class="parameter"><tt>keyval</tt></i> is in lower case or is not subject to case
conversion.</p></div><div class="refsect2" lang="en"><a name="function-gdk--keyval-to-unicode"></a><h3>gtk.gdk.keyval_to_unicode</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">gtk.gdk.keyval_to_unicode</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>keyval</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>keyval</tt></b>:</span></td><td>the key value</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td> the corresponding unicode character, or 0 if
there is no corresponding character.</td></tr></tbody></table><p>The <tt class="function">gtk.gdk.keyval_to_unicode</tt>() function
converts the key value specified by <i class="parameter"><tt>keyval</tt></i> to the
corresponding ISO10646 (Unicode) character.</p></div><div class="refsect2" lang="en"><a name="function-gdk--unicode-to-keyval"></a><h3>gtk.gdk.unicode_to_keyval</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">gtk.gdk.unicode_to_keyval</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>wc</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>wc</tt></b>:</span></td><td> a ISO10646 encoded (unicode)
character</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>the corresponding key value, if one exists. or,
if there is no corresponding symbol, <i class="parameter"><tt>wc</tt></i> |
0x01000000</td></tr></tbody></table><p>The <tt class="function">gtk.gdk.unicode_to_keyval</tt>() function
converts the ISO10646 (unicode) character specified by
<i class="parameter"><tt>wc</tt></i> to a key value.</p></div></div><div class="refsect1" lang="en"><a name="id2982553"></a><h2>Signals</h2><div class="refsect2" lang="en"><a name="signal-gdkkeymap--direction-changed"></a><h3>The "direction-changed" gtk.gdk.Keymap Signal</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><i class="parameter"><tt>gdkkeymap</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>user_param1</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>...</tt></i></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><i class="parameter"><tt>gdkkeymap</tt></i>:</span></td><td>the gdkkeymap that received the
signal</td></tr><tr><td><span class="term"><i class="parameter"><tt>user_param1</tt></i>:</span></td><td>the first user parameter (if any) specified
with the <a href="class-gobject.html#method-gobject--connect" title="gobject.GObject.connect"><tt class="methodname">connect</tt>()</a>
method</td></tr><tr><td><span class="term"><i class="parameter"><tt>...</tt></i>:</span></td><td>additional user parameters (if
any)</td></tr></tbody></table><p>The "direction-changed" signal is emitted when the pango text
direction of <i class="parameter"><tt>gdkkeymap</tt></i> is changed</p></div><div class="refsect2" lang="en"><a name="signal-gdkkeymap--keys-changed"></a><h3>The "keys-changed" gtk.gdk.Keymap Signal</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><i class="parameter"><tt>gdkkeymap</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>user_param1</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>...</tt></i></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><i class="parameter"><tt>gdkkeymap</tt></i>:</span></td><td>the gdkkeymap that received the
signal</td></tr><tr><td><span class="term"><i class="parameter"><tt>user_param1</tt></i>:</span></td><td>the first user parameter (if any) specified
with the <a href="class-gobject.html#method-gobject--connect" title="gobject.GObject.connect"><tt class="methodname">connect</tt>()</a>
method</td></tr><tr><td><span class="term"><i class="parameter"><tt>...</tt></i>:</span></td><td>additional user parameters (if
any)</td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This signal is available in GTK+ 2.2 and above.</p></div><p>The "keys-changed" signal is emitted when the mapping
represented by <i class="parameter"><tt>keymap</tt></i> changes.</p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="class-gdkimage.html">Prev</a></td><td width="20%" align="center"><a accesskey="u" href="gdk-class-reference.html">Up</a></td><td width="40%" align="right"><a accesskey="n" href="class-gdkpixbuf.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">gtk.gdk.Image</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">gtk.gdk.Pixbuf</td></tr></table></div></body></html>
|