/usr/share/gtk-doc/html/pygtk/class-gtklabel.html is in python-gtk2-doc 2.24.0-5.1ubuntu2.
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 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 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 | <html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>gtk.Label</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"><link rel="home" href="index.html" title="PyGTK 2.0 Reference Manual"><link rel="up" href="gtk-class-reference.html" title="The gtk Class Reference"><link rel="prev" href="class-gtkitemfactory.html" title="gtk.ItemFactory"><link rel="next" href="class-gtklayout.html" title="gtk.Layout"></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.Label</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-gtkitemfactory.html">Prev</a> </td><th width="60%" align="center">The gtk Class Reference</th><td width="20%" align="right"> <a accesskey="n" href="class-gtklayout.html">Next</a></td></tr></table><hr></div><div class="refentry" title="gtk.Label"><a name="class-gtklabel"></a><div class="titlepage"></div><div class="refnamediv"><h2>gtk.Label</h2><p>gtk.Label — a widget that displays a limited amount of read-only
text</p></div><div class="refsect1" title="Synopsis"><a name="id3770705"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gtk.Label</span></span>(<span class="ooclass"><span class="classname"><a class="link" href="class-gtkmisc.html" title="gtk.Misc">gtk.Misc</a></span></span>):
<code class="constructorsynopsis"> <span class="methodname"><a class="link" href="class-gtklabel.html#constructor-gtklabel" title="Constructor">gtk.Label</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>str</code></strong></span><span class="initializer">=None</span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--set-text" title="gtk.Label.set_text">set_text</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>str</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--get-text" title="gtk.Label.get_text">get_text</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--set-attributes" title="gtk.Label.set_attributes">set_attributes</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>attrs</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--get-attributes" title="gtk.Label.get_attributes">get_attributes</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--set-label" title="gtk.Label.set_label">set_label</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>str</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--get-label" title="gtk.Label.get_label">get_label</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--set-markup" title="gtk.Label.set_markup">set_markup</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>str</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--set-use-markup" title="gtk.Label.set_use_markup">set_use_markup</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>setting</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--get-use-markup" title="gtk.Label.get_use_markup">get_use_markup</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--set-use-underline" title="gtk.Label.set_use_underline">set_use_underline</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>setting</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--get-use-underline" title="gtk.Label.get_use_underline">get_use_underline</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--set-markup-with-mnemonic" title="gtk.Label.set_markup_with_mnemonic">set_markup_with_mnemonic</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>str</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--get-mnemonic-keyval" title="gtk.Label.get_mnemonic_keyval">get_mnemonic_keyval</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--set-mnemonic-widget" title="gtk.Label.set_mnemonic_widget">set_mnemonic_widget</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>widget</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--get-mnemonic-widget" title="gtk.Label.get_mnemonic_widget">get_mnemonic_widget</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--set-text-with-mnemonic" title="gtk.Label.set_text_with_mnemonic">set_text_with_mnemonic</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>str</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--set-justify" title="gtk.Label.set_justify">set_justify</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>jtype</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--get-justify" title="gtk.Label.get_justify">get_justify</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--set-pattern" title="gtk.Label.set_pattern">set_pattern</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>pattern</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--set-line-wrap" title="gtk.Label.set_line_wrap">set_line_wrap</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>wrap</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--get-line-wrap" title="gtk.Label.get_line_wrap">get_line_wrap</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--set-selectable" title="gtk.Label.set_selectable">set_selectable</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>setting</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--get-selectable" title="gtk.Label.get_selectable">get_selectable</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--select-region" title="gtk.Label.select_region">select_region</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>start_offset</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>end_offset</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--get-selection-bounds" title="gtk.Label.get_selection_bounds">get_selection_bounds</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--get-layout" title="gtk.Label.get_layout">get_layout</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--get-layout-offsets" title="gtk.Label.get_layout_offsets">get_layout_offsets</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--set-ellipsize" title="gtk.Label.set_ellipsize">set_ellipsize</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>mode</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--get-ellipsize" title="gtk.Label.get_ellipsize">get_ellipsize</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--set-width-chars" title="gtk.Label.set_width_chars">set_width_chars</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>n_chars</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--get-width-chars" title="gtk.Label.get_width_chars">get_width_chars</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--set-single-line-mode" title="gtk.Label.set_single_line_mode">set_single_line_mode</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>single_line_mode</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--get-single-line-mode" title="gtk.Label.get_single_line_mode">get_single_line_mode</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--get-single-line-mode" title="gtk.Label.get_single_line_mode">get_max_width_chars</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--set-single-line-mode" title="gtk.Label.set_single_line_mode">set_max_width_chars</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>n_chars</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--get-angle" title="gtk.Label.get_angle">get_angle</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--set-angle" title="gtk.Label.set_angle">set_angle</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>angle</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--get-current-uri" title="gtk.Label.get_current_uri">get_current_uri</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--set-track-visited-links" title="gtk.Label.set_track_visited_links">set_track_visited_links</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>track_links</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--get-track-visited-links" title="gtk.Label.get_track_visited_links">get_track_visited_links</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--set-line-wrap-mode" title="gtk.Label.set_line_wrap_mode">set_line_wrap_mode</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>wrap_mode</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtklabel.html#method-gtklabel--get-line-wrap-mode" title="gtk.Label.get_line_wrap_mode">get_line_wrap_mode</a></span>(<span class="methodparam"></span>)</code><br></pre></td></tr></table></div><div class="refsect1" title="Ancestry"><a name="id3771785"></a><h2>Ancestry</h2><pre class="synopsis">+-- <PYGTKDOCLINK HREF="class-gobject">gobject.GObject</PYGTKDOCLINK>
+-- <a class="link" href="class-gtkobject.html" title="gtk.Object">gtk.Object</a>
+-- <a class="link" href="class-gtkwidget.html" title="gtk.Widget">gtk.Widget</a>
+-- <a class="link" href="class-gtkmisc.html" title="gtk.Misc">gtk.Misc</a>
+-- <a class="link" href="class-gtklabel.html" title="gtk.Label">gtk.Label</a>
</pre></div><div class="refsect1" title="Implemented Interfaces"><a name="id3771829"></a><h2>Implemented Interfaces</h2><p>
<a class="link" href="class-gtklabel.html" title="gtk.Label"><code class="classname">gtk.Label</code></a>
implements
<a class="link" href="class-gtkbuildable.html" title="gtk.Buildable"><code class="classname">gtk.Buildable</code></a>
</p></div><div class="refsect1" title="gtk.Label Properties"><a name="properties-gtklabel"></a><h2>gtk.Label Properties</h2><p><a class="link" href="class-gtkobject.html#properties-gtkobject" title="gtk.Object Properties">gtk.Object Properties</a></p><p><a class="link" href="class-gtkwidget.html#properties-gtkwidget" title="gtk.Widget Properties">gtk.Widget Properties</a></p><p><a class="link" href="class-gtkmisc.html#properties-gtkmisc" title="gtk.Misc Properties">gtk.Misc Properties</a></p><div class="blockquote"><table width="100%" border="0" bgcolor="#E0E0E0"><tr><td valign="top"><div class="informaltable"><table width="100%" border="0"><colgroup><col width="1in"><col width="1in"><col width="4in"></colgroup><tbody><tr valign="top"><td valign="top">"angle"</td><td valign="top">Read-Write</td><td valign="top">The angle that the baseline of the label makes with the
horizontal, in degrees, measured counterclockwise. An angle of 90 reads from
from bottom to top, an angle of 270, from top to bottom. Ignored if the label
is selectable, wrapped, or ellipsized. Allowed values: [0,360]
Default value: 0. Available in GTK+ 2.6 and above.</td></tr><tr valign="top"><td valign="top">"attributes"</td><td valign="top">Read-Write</td><td valign="top">A list of Pango style attributes to apply to the text
of the label.</td></tr><tr valign="top"><td valign="top">"cursor-position"</td><td valign="top">Read</td><td valign="top">The current position of the insertion cursor in
chars. Allowed values: >= 0. Default value: 0</td></tr><tr valign="top"><td valign="top">"ellipsize"</td><td valign="top">Read-Write</td><td valign="top">The preferred place to ellipsize the string, if the
label does not have enough room to display the entire string, specified as
one of the <a class="xref" href="pango-constants.html#pango-ellipsize-mode-constants" title="Pango Ellipsize Mode Constants">Pango Ellipsize Mode Constants</a>. Note that setting
this property to a value other than <code class="literal">pango.ELLIPSIZE_NONE</code>
has the side-effect that the label requests only enough space to display the
ellipsis "...". In particular, this means that ellipsizing labels don't work
well in notebook tabs, unless the tab's "tab-expand" property is set to
<code class="literal">True</code>. Other means to set a label's width are with the
<a class="link" href="class-gtkwidget.html#method-gtkwidget--set-size-request" title="gtk.Widget.set_size_request"><code class="methodname">gtk.Widget.set_size_request</code>()</a>
and <a class="link" href="class-gtklabel.html#method-gtklabel--set-width-chars" title="gtk.Label.set_width_chars"><code class="methodname">set_width_chars</code>()</a>
methods. Default value: <code class="literal">pango.ELLIPSIZE_NONE</code>. Available
in GTK+ 2.6 and above.</td></tr><tr valign="top"><td valign="top">"justify"</td><td valign="top">Read-Write</td><td valign="top">The alignment of the lines in the text of the label
relative to each other. The possible values are:
<code class="literal">gtk.JUSTIFY_LEFT</code>, <code class="literal">gtk.JUSTIFY_RIGHT</code>,
<code class="literal">gtk.JUSTIFY_CENTER</code>, <code class="literal">gtk.JUSTIFY_FILL</code>.
This does NOT affect the alignment of the label within its
allocation. Default value: <code class="literal">gtk.JUSTIFY_LEFT</code></td></tr><tr valign="top"><td valign="top">"label"</td><td valign="top">Read-Write</td><td valign="top">The text of the label. Default value:
<code class="literal">None</code></td></tr><tr valign="top"><td valign="top">"max-width-chars"</td><td valign="top">Read-Write</td><td valign="top">The desired maximum width of the label, in characters.
If this property is set to -1, the width will be calculated automatically,
otherwise the label will request space for no more than the requested number
of characters. If the "width-chars" property is set to a positive value, then
the "max-width-chars" property is ignored. Allowed values: >= -1.
Default value: -1. Available in GTK+ 2.6 and above.</td></tr><tr valign="top"><td valign="top">"mnemonic-keyval"</td><td valign="top">Read</td><td valign="top">The mnemonic accelerator key for this label. Default
value: 16777215</td></tr><tr valign="top"><td valign="top">"mnemonic-widget"</td><td valign="top">Read-Write</td><td valign="top">The widget to be activated when the label's mnemonic
key is pressed.</td></tr><tr valign="top"><td valign="top">"pattern"</td><td valign="top">Write</td><td valign="top">A string with _ characters in positions used to
identify to characters in the text to underline. Default value:
<code class="literal">None</code></td></tr><tr valign="top"><td valign="top">"selectable"</td><td valign="top">Read-Write</td><td valign="top">If <code class="literal">True</code>, the label text can be
selected with the mouse. Default value: <code class="literal">False</code></td></tr><tr valign="top"><td valign="top">"selection-bound"</td><td valign="top">Read</td><td valign="top">The position of the opposite end of the selection from
the cursor in chars. Allowed values: >= 0. Default value: 0.</td></tr><tr valign="top"><td valign="top">"single-line-mode"</td><td valign="top">Read-Write</td><td valign="top">If <code class="literal">True</code> the label is in single line
mode. In single line mode, the height of the label does not depend on the
actual text, it is always set to ascent + descent of the font. This can be
an advantage in situations where resizing the label because of text changes
would be distracting, e.g. in a statusbar. Default value:
<code class="literal">False</code>. Available in GTK+ 2.6 and above.</td></tr><tr valign="top"><td valign="top">"track-visited-links"</td><td valign="top">Read-Write</td><td valign="top">If <code class="literal">True</code> the label tracks which links have been clicked.
It will then apply the "visited-link-color" color, instead of "link-color".
<code class="literal">False</code>. Available in GTK+ 2.18 and above.</td></tr><tr valign="top"><td valign="top">"use-markup"</td><td valign="top">Read-Write</td><td valign="top">If <code class="literal">True</code>, the text of the label
includes XML markup. Default value: <code class="literal">False</code></td></tr><tr valign="top"><td valign="top">"use-underline"</td><td valign="top">Read-Write</td><td valign="top">If <code class="literal">True</code>, an underscore in the text
indicates the next character should be used for the mnemonic accelerator
key. Default value: <code class="literal">False</code></td></tr><tr valign="top"><td valign="top">"width-chars"</td><td valign="top">Read-Write</td><td valign="top">The desired width of the label, in characters. If this
property is set to -1, the width will be calculated automatically, otherwise
the label will request either 3 characters or the property value, whichever
is greater. Allowed values: >= -1. Default value: -1. Available in GTK+
2.6 and above.</td></tr><tr valign="top"><td valign="top">"wrap"</td><td valign="top">Read-Write</td><td valign="top">If <code class="literal">True</code>, wrap lines if the text
becomes too wide. Default value: <code class="literal">False</code></td></tr><tr valign="top"><td valign="top">"wrap-mode"</td><td valign="top">Read-Write</td><td valign="top">If line wrapping is on, this controls how the line wrapping is done.
The default is <code class="literal">pango.WRAP_WORD</code>, which means wrap on word boundaries.
Available in GTK+ 2.10 and above</td></tr></tbody></table></div></td></tr></table></div></div><div class="refsect1" title="gtk.Label Style Properties"><a name="style-properties-gtklabel"></a><h2>gtk.Label Style Properties</h2><p><a class="link" href="class-gtkwidget.html#style-properties-gtkwidget" title="gtk.Widget Style Properties">gtk.Widget Style Properties</a></p></div><div class="refsect1" title="gtk.Label Signal Prototypes"><a name="signal-prototypes-gtklabel"></a><h2>gtk.Label Signal Prototypes</h2><p><PYGTKDOCLINK HREF="signal-prototypes-gobject">gobject.GObject Signal Prototypes</PYGTKDOCLINK></p><p><a class="link" href="class-gtkobject.html#signal-prototypes-gtkobject" title="gtk.Object Signal Prototypes">gtk.Object Signal Prototypes</a></p><p><a class="link" href="class-gtkwidget.html#signal-prototypes-gtkwidget" title="gtk.Widget Signal Prototypes">gtk.Widget Signal Prototypes</a></p><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term">"<a class="link" href="class-gtklabel.html#signal-gtklabel--activate-current-link" title='The "activate-current-link" gtk.Label Signal'>activate-current-link</a>"</span></p></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>label</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></td></tr><tr><td><p><span class="term">"<a class="link" href="class-gtklabel.html#signal-gtklabel--activate-link" title='The "activate-link" gtk.Label Signal'>activate-link</a>"</span></p></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>label</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>uri</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></td></tr><tr><td><p><span class="term">"<a class="link" href="class-gtklabel.html#signal-gtklabel--copy-clipboard" title='The "copy-clipboard" gtk.Label Signal'>copy-clipboard</a>"</span></p></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>label</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></td></tr><tr><td><p><span class="term">"<a class="link" href="class-gtklabel.html#signal-gtklabel--move-cursor" title='The "move-cursor" gtk.Label Signal'>move-cursor</a>"</span></p></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>label</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>step</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>count</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>extend_selection</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></td></tr><tr><td><p><span class="term">"<a class="link" href="class-gtklabel.html#signal-gtklabel--populate-popup" title='The "populate-popup" gtk.Label Signal'>populate-popup</a>"</span></p></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>label</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>menu</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></td></tr></tbody></table></div><div class="refsect1" title="Description"><a name="id3772915"></a><h2>Description</h2><p>The <a class="link" href="class-gtklabel.html" title="gtk.Label"><code class="classname">gtk.Label</code></a> is a widget
class that displays a limited amount of read-only text. Labels are used by
several widgets (e.g. <a class="link" href="class-gtkbutton.html" title="gtk.Button"><code class="classname">gtk.Button</code></a>, and its
subclasses, <a class="link" href="class-gtkmenuitem.html" title="gtk.MenuItem"><code class="classname">gtk.MenuItem</code></a>,
etc.) to provide text display as well as by applications to display
messages, etc, to the user. Most of the functionality of a <a class="link" href="class-gtklabel.html" title="gtk.Label"><code class="classname">gtk.Label</code></a> is directed
at modifying the style and layout of the text within the widget allocation.
A <a class="link" href="class-gtklabel.html" title="gtk.Label"><code class="classname">gtk.Label</code></a> is
a "windowless" object which means that it cannot receive events directly. A
<a class="link" href="class-gtkeventbox.html" title="gtk.EventBox"><code class="classname">gtk.EventBox</code></a>
can be used to provide event handling capabilities to a <a class="link" href="class-gtklabel.html" title="gtk.Label"><code class="classname">gtk.Label</code></a> widget if
needed.</p><div class="refsect2" title="Mnemonics"><a name="id3772983"></a><h3>Mnemonics</h3><p>Label text may be specified with embedded underscore characters
that are used to indicate that the following character should be underlined
and used as the mnemonic accelerator (if it's the first underlined
character). The <a class="link" href="class-gtklabel.html#method-gtklabel--set-text-with-mnemonic" title="gtk.Label.set_text_with_mnemonic"><code class="methodname">set_text_with_mnemonic</code>()</a>
method is used to parse the label text for a mnemonic characters. Mnemonics
automatically activate any activatable widget the label is inside, such as a
<a class="link" href="class-gtkbutton.html" title="gtk.Button"><code class="classname">gtk.Button</code></a>; if
the label is not inside an activatable widget, you have to tell the label
about the target using the <a class="link" href="class-gtklabel.html#method-gtklabel--set-mnemonic-widget" title="gtk.Label.set_mnemonic_widget"><code class="methodname">set_mnemonic_widget</code>()</a>
method. Here's a simple example where the label is inside a button:</p><pre class="programlisting">
# Pressing Alt+H will activate this button
button = gtk.Button()
label = gtk.Label("_Hello")
label.set_use_underline(True)
button.add(label)
</pre><p>As a convenience you can create a button with a mnemonic label
as follows:</p><pre class="programlisting">
# Pressing Alt+H will activate this button
button = gtk.Button(label="_Hello", use_underline=True)
</pre><p>To create a mnemonic for a widget alongside the label, such as a
<a class="link" href="class-gtkentry.html" title="gtk.Entry"><code class="classname">gtk.Entry</code></a>, you
have to point the label at the entry with the <a class="link" href="class-gtklabel.html#method-gtklabel--set-mnemonic-widget" title="gtk.Label.set_mnemonic_widget"><code class="methodname">set_mnemonic_widget</code>()</a>
method:</p><pre class="programlisting">
# Pressing Alt+H will focus the entry
entry = gtk.Entry()
label = gtk.Label("_Hello")
label.set_use_underline(True)
label.set_mnemonic_widget(entry)
</pre></div><div class="refsect2" title="Markup (styled text)"><a name="id3773080"></a><h3>Markup (styled text)</h3><p>To make it easy to format text in a label (changing colors, fonts,
etc.), the label text can be provided in the <a class="link" href="pango-markup-language.html" title="The Pango Markup Language">Pango markup format</a> which is a simple
XML markup format. The <a class="link" href="class-gtklabel.html#method-gtklabel--set-markup" title="gtk.Label.set_markup"><code class="methodname">gtk.Label.set_markup</code>()</a>
method sets the label using text in valid markup format (e.g. '<', '>'
and '&' characters must be replaced by &lt;, &gt; and &amp;
respectively. For example:</p><pre class="programlisting">
label = gtk.Label()
label.set_markup("<small>Small text</small>");
</pre><p>The markup passed to the <a class="link" href="class-gtklabel.html#method-gtklabel--set-markup" title="gtk.Label.set_markup"><code class="methodname">set_markup</code>()</a>
method must be valid. For example, the literal <>& characters must
be escaped as &lt;, &gt;, and &amp;. If you pass text obtained
from the user, file, or a network to the <a class="link" href="class-gtklabel.html#method-gtklabel--set-markup" title="gtk.Label.set_markup"><code class="methodname">set_markup</code>()</a>
method, you'll want to escape it with the Python Library
<code class="function">xml.sax.saxutils.escape</code>() function.</p><p>Markup strings are just a convenient way to set the <a class="link" href="class-pangoattrlist.html" title="pango.AttrList"><code class="classname">pango.AttrList</code></a>
on a label. Using the <a class="link" href="class-gtklabel.html#method-gtklabel--set-attributes" title="gtk.Label.set_attributes"><code class="methodname">set_attributes</code>()</a>
method may be a simpler way to set attributes in some cases. Be careful
though; <a class="link" href="class-pangoattrlist.html" title="pango.AttrList"><code class="classname">pango.AttrList</code></a>
tends to cause internationalization problems, unless you're applying
attributes to the entire string because specifying the start_index and
end_index for a <a class="link" href="class-pangoattribute.html" title="pango.Attribute"><code class="classname">pango.Attribute</code></a>
requires knowledge of the exact string being displayed, so translations will
cause problems.</p></div><div class="refsect2" title="Selectable labels"><a name="id3773191"></a><h3>Selectable labels</h3><p>Labels can be made selectable with the <a class="link" href="class-gtklabel.html#method-gtklabel--set-selectable" title="gtk.Label.set_selectable"><code class="methodname">set_selectable</code>()</a>
method. Selectable labels allow the user to copy the label contents to the
clipboard. Only labels that contain useful-to-copy information such as error
messages should be made selectable.</p></div><div class="refsect2" title="Text layout"><a name="id3773215"></a><h3>Text layout</h3><p>A label can contain any number of paragraphs, but will have
performance problems if it contains more than a small number. Paragraphs are
separated by newlines or other paragraph separators understood by
Pango.</p><p>Labels can automatically wrap text if you call the <a class="link" href="class-gtklabel.html#method-gtklabel--set-line-wrap" title="gtk.Label.set_line_wrap"><code class="methodname">set_line_wrap</code>()</a>
method.</p><p>The <a class="link" href="class-gtklabel.html#method-gtklabel--set-justify" title="gtk.Label.set_justify"><code class="methodname">set_justify</code>()</a>
method sets how the lines in a label align with one another. If you want to
set how the label as a whole aligns in its available space, see the <a class="link" href="class-gtkmisc.html#method-gtkmisc--set-alignment" title="gtk.Misc.set_alignment"><code class="methodname">gtk.Misc.set_alignment</code>()</a>
method.</p></div></div><div class="refsect1" title="Constructor"><a name="constructor-gtklabel"></a><h2>Constructor</h2><pre class="programlisting"><code class="constructorsynopsis"> <span class="methodname">gtk.Label</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>str</code></strong></span><span class="initializer">=None</span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>str</code></strong> :</span></p></td><td>The text of the label or <code class="literal">None</code>
for a blank label</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the new <a class="link" href="class-gtklabel.html" title="gtk.Label"><code class="classname">gtk.Label</code></a>
widget</td></tr></tbody></table><p>Creates a new <a class="link" href="class-gtklabel.html" title="gtk.Label"><code class="classname">gtk.Label</code></a> with the
text specified by <em class="parameter"><code>str</code></em> inside it. You can pass
<code class="literal">None</code> to get a blank label.</p></div><div class="refsect1" title="Methods"><a name="id3773384"></a><h2>Methods</h2><div class="refsect2" title="gtk.Label.set_text"><a name="method-gtklabel--set-text"></a><h3>gtk.Label.set_text</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_text</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>str</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>str</code></strong> :</span></p></td><td>The new text for the
label.</td></tr></tbody></table><p>The <code class="methodname">set_text</code>() method sets the text
within the <a class="link" href="class-gtklabel.html" title="gtk.Label"><code class="classname">gtk.Label</code></a> widget. It
replaces any text that was there before and will clear any previously set
mnemonic accelerators.</p></div><div class="refsect2" title="gtk.Label.get_text"><a name="method-gtklabel--get-text"></a><h3>gtk.Label.get_text</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_text</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the text in the label
widget.</td></tr></tbody></table><p>The <code class="methodname">get_text</code>() method fetches the text
from a label widget, as displayed on the screen. This does not include any
Pango markup or embedded underscore characters indicating mnemonics. (See
<a class="link" href="class-gtklabel.html#method-gtklabel--get-label" title="gtk.Label.get_label"><code class="methodname">get_label</code>()</a>).</p></div><div class="refsect2" title="gtk.Label.set_attributes"><a name="method-gtklabel--set-attributes"></a><h3>gtk.Label.set_attributes</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_attributes</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>attrs</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>attrs</code></strong> :</span></p></td><td>a <a class="link" href="class-pangoattrlist.html" title="pango.AttrList"><code class="classname">pango.AttrList</code></a></td></tr></tbody></table><p>The <code class="methodname">set_attributes</code>() method applies a
<a class="link" href="class-pangoattrlist.html" title="pango.AttrList"><code class="classname">pango.AttrList</code></a>
list of attributes to the label text. The attributes set with this function
will be ignored if either the "use-underline" or "use-markup" attributes is
<code class="literal">True</code>.</p></div><div class="refsect2" title="gtk.Label.get_attributes"><a name="method-gtklabel--get-attributes"></a><h3>gtk.Label.get_attributes</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_attributes</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the attribute list, or <code class="literal">None</code>
if no attributes were set.</td></tr></tbody></table><p>The <code class="methodname">get_attributes</code>() method returns the
attribute list that was set on the label using <a class="link" href="class-gtklabel.html#method-gtklabel--set-attributes" title="gtk.Label.set_attributes"><code class="methodname">set_attributes</code>()</a>,
if any. This function does not reflect attributes that come from the labels
markup (see <a class="link" href="class-gtklabel.html#method-gtklabel--set-markup" title="gtk.Label.set_markup"><code class="methodname">set_markup</code>()</a>).</p></div><div class="refsect2" title="gtk.Label.set_label"><a name="method-gtklabel--set-label"></a><h3>gtk.Label.set_label</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_label</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>str</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>str</code></strong> :</span></p></td><td>the new text (including mnemonics or markup) to
set for the label</td></tr></tbody></table><p>The <code class="methodname">set_label</code>() method sets the text of
the label. The label is parsed for embedded underscores and Pango markup
depending on the values of the "use-underline" and "use-markup"
properties.</p></div><div class="refsect2" title="gtk.Label.get_label"><a name="method-gtklabel--get-label"></a><h3>gtk.Label.get_label</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_label</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the text of the label
widget.</td></tr></tbody></table><p>The <code class="methodname">get_label</code>() method returns the text
from a label widget including any Pango markup and embedded underscores
indicating mnemonics. (See <a class="link" href="class-gtklabel.html#method-gtklabel--get-text" title="gtk.Label.get_text"><code class="methodname">get_text</code>()</a>
that just returns the text).</p></div><div class="refsect2" title="gtk.Label.set_markup"><a name="method-gtklabel--set-markup"></a><h3>gtk.Label.set_markup</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_markup</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>str</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>str</code></strong> :</span></p></td><td>a markup string</td></tr></tbody></table><p>The <code class="methodname">set_markup</code>() method parses
<em class="parameter"><code>str</code></em>, which is marked up with the Pango text markup
language, and sets the label's text and attribute list.</p></div><div class="refsect2" title="gtk.Label.set_use_markup"><a name="method-gtklabel--set-use-markup"></a><h3>gtk.Label.set_use_markup</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_use_markup</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>setting</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>setting</code></strong> :</span></p></td><td>if <code class="literal">True</code> the label's text
should be parsed for markup.</td></tr></tbody></table><p>The <code class="methodname">set_use_markup</code>() method sets the
"use-markup" property to the value of <em class="parameter"><code>setting</code></em>. If
<code class="literal">True</code> the text of the label should be parsed as
markup.</p></div><div class="refsect2" title="gtk.Label.get_use_markup"><a name="method-gtklabel--get-use-markup"></a><h3>gtk.Label.get_use_markup</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_use_markup</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td><code class="literal">True</code> if the label's text
will be parsed for markup.</td></tr></tbody></table><p>The <code class="methodname">get_use_markup</code>() method returns
the value of the "use-markup" property. If <code class="literal">True</code> the
label's text is parsed as markup. See <a class="link" href="class-gtklabel.html#method-gtklabel--set-use-markup" title="gtk.Label.set_use_markup"><code class="methodname">set_use_markup</code>()</a>.</p></div><div class="refsect2" title="gtk.Label.set_use_underline"><a name="method-gtklabel--set-use-underline"></a><h3>gtk.Label.set_use_underline</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_use_underline</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>setting</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>setting</code></strong> :</span></p></td><td>if <code class="literal">True</code> underscores in the
text indicate mnemonics</td></tr></tbody></table><p>The <code class="methodname">set_use_underline</code>() method sets the
"use-underline" property to the value of <em class="parameter"><code>setting</code></em>. If
<em class="parameter"><code>setting</code></em> is <code class="literal">True</code>, an underscore in
the text indicates the next character should be used for the mnemonic
accelerator key.</p></div><div class="refsect2" title="gtk.Label.get_use_underline"><a name="method-gtklabel--get-use-underline"></a><h3>gtk.Label.get_use_underline</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_use_underline</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td><code class="literal">True</code> if an embedded
underscore in the label indicates the mnemonic
accelerator.</td></tr></tbody></table><p>The <code class="methodname">get_use_underline</code>() method returns
the value of the "use-underline" property. If <code class="literal">True</code> an
embedded underscore in the label indicates the next character is a mnemonic.
See <a class="link" href="class-gtklabel.html#method-gtklabel--set-use-underline" title="gtk.Label.set_use_underline"><code class="methodname">set_use_underline</code>()</a>.</p></div><div class="refsect2" title="gtk.Label.set_markup_with_mnemonic"><a name="method-gtklabel--set-markup-with-mnemonic"></a><h3>gtk.Label.set_markup_with_mnemonic</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_markup_with_mnemonic</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>str</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>str</code></strong> :</span></p></td><td>a markup string including embedded
underscores</td></tr></tbody></table><p>The <code class="methodname">set_markup_with_mnemonic</code>() method
parses <em class="parameter"><code>str</code></em> as markup, setting the label's text and
attribute list based on the parse results. If characters in
<em class="parameter"><code>str</code></em> are preceded by an underscore, they are
underlined indicating that they represent a mnemonic accelerator. The
mnemonic key can be used to activate another widget, chosen automatically,
or explicitly using the <a class="link" href="class-gtklabel.html#method-gtklabel--set-mnemonic-widget" title="gtk.Label.set_mnemonic_widget"><code class="methodname">set_mnemonic_widget</code>()</a>
method.</p></div><div class="refsect2" title="gtk.Label.get_mnemonic_keyval"><a name="method-gtklabel--get-mnemonic-keyval"></a><h3>gtk.Label.get_mnemonic_keyval</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_mnemonic_keyval</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a keyval, or the void symbol
keyval</td></tr></tbody></table><p>The <code class="methodname">get_mnemonic_keyval</code>() method
returns the value of the "mnemonic-keyval" property that contains the keyval
used for the mnemonic accelerator if one has been set on the label. If there
is no mnemonic set up it returns the void symbol keyval.</p></div><div class="refsect2" title="gtk.Label.set_mnemonic_widget"><a name="method-gtklabel--set-mnemonic-widget"></a><h3>gtk.Label.set_mnemonic_widget</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_mnemonic_widget</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>widget</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>widget</code></strong> :</span></p></td><td>the widget to be activated when the mnemonic is
pressed</td></tr></tbody></table><p>The <code class="methodname">set_mnemonic_widget</code>() method sets
the "mnemonic-widget" property using the value of
<em class="parameter"><code>widget</code></em>. This method associates the label mnemonic
with a widget that will be activated when the mnemonic accelerator is
pressed. When the label is inside a widget (like a <a class="link" href="class-gtkbutton.html" title="gtk.Button"><code class="classname">gtk.Button</code></a> or a
<a class="link" href="class-gtknotebook.html" title="gtk.Notebook"><code class="classname">gtk.Notebook</code></a>
tab) it is automatically associated with the correct widget, but sometimes
(i.e. when the target is a <a class="link" href="class-gtkentry.html" title="gtk.Entry"><code class="classname">gtk.Entry</code></a> next to the
label) you need to set it explicitly using this function. The target widget
will be activated by emitting "mnemonic_activate" on it.</p></div><div class="refsect2" title="gtk.Label.get_mnemonic_widget"><a name="method-gtklabel--get-mnemonic-widget"></a><h3>gtk.Label.get_mnemonic_widget</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_mnemonic_widget</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the target of the label's mnemonic, or
<code class="literal">None</code> if none has been set and the default algorithm will
be used.</td></tr></tbody></table><p>The <code class="methodname">get_mnemonic_widget</code>() method
retrieves the value of the "mnemonic-widget" property which is the target of
the mnemonic accelerator of this label. See <a class="link" href="class-gtklabel.html#method-gtklabel--set-mnemonic-widget" title="gtk.Label.set_mnemonic_widget"><code class="methodname">set_mnemonic_widget</code>()</a>.</p></div><div class="refsect2" title="gtk.Label.set_text_with_mnemonic"><a name="method-gtklabel--set-text-with-mnemonic"></a><h3>gtk.Label.set_text_with_mnemonic</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_text_with_mnemonic</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>str</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>str</code></strong> :</span></p></td><td>the label text with embedded underscore
characters indicating the mnemonic characters</td></tr></tbody></table><p>The <code class="methodname">set_text_with_mnemonic</code>() method
sets the label's text from the string <em class="parameter"><code>str</code></em>. If
characters in <em class="parameter"><code>str</code></em> are preceded by an underscore, they
are underlined indicating that they represent a mnemonic accelerator. The
mnemonic key can be used to activate another widget, chosen automatically,
or explicitly using the <a class="link" href="class-gtklabel.html#method-gtklabel--set-mnemonic-widget" title="gtk.Label.set_mnemonic_widget"><code class="methodname">set_mnemonic_widget</code>()</a>
method.</p></div><div class="refsect2" title="gtk.Label.set_justify"><a name="method-gtklabel--set-justify"></a><h3>gtk.Label.set_justify</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_justify</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>jtype</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>jtype</code></strong> :</span></p></td><td>justification type</td></tr></tbody></table><p>The <code class="methodname">set_justify</code>() method sets the
alignment of the lines in the text of the label relative to each other using
the value of <em class="parameter"><code>jtype</code></em>. The possible values of
<em class="parameter"><code>jtype</code></em> are: <code class="literal">gtk.JUSTIFY_LEFT</code>,
<code class="literal">gtk.JUSTIFY_RIGHT</code>, <code class="literal">gtk.JUSTIFY_CENTER</code>
and <code class="literal">gtk.JUSTIFY_FILL</code>. <code class="literal">gtk.JUSTIFY_LEFT</code>
is the default value when the widget is first created. If you want to set
the alignment of the label as a whole, use the <a class="link" href="class-gtkmisc.html#method-gtkmisc--set-alignment" title="gtk.Misc.set_alignment"><code class="methodname">gtk.Misc.set_alignment</code>()</a>
method instead. The <a class="link" href="class-gtklabel.html#method-gtklabel--set-justify" title="gtk.Label.set_justify"><code class="methodname">set_justify</code>()</a>
has no effect on labels containing only a single line.</p></div><div class="refsect2" title="gtk.Label.get_justify"><a name="method-gtklabel--get-justify"></a><h3>gtk.Label.get_justify</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_justify</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the label justification</td></tr></tbody></table><p>The <code class="methodname">get_justify</code>() method returns the
justification of the label; one of: <code class="literal">gtk.JUSTIFY_LEFT</code>,
<code class="literal">gtk.JUSTIFY_RIGHT</code>, <code class="literal">gtk.JUSTIFY_CENTER</code>
or <code class="literal">gtk.JUSTIFY_FILL</code>. See <a class="link" href="class-gtklabel.html#method-gtklabel--set-justify" title="gtk.Label.set_justify"><code class="methodname">set_justify</code>()</a>.</p></div><div class="refsect2" title="gtk.Label.set_pattern"><a name="method-gtklabel--set-pattern"></a><h3>gtk.Label.set_pattern</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_pattern</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>pattern</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>pattern</code></strong> :</span></p></td><td>the pattern of underlines</td></tr></tbody></table><p>The <code class="methodname">set_pattern</code>() method sets the
"pattern" property with the value of <em class="parameter"><code>pattern</code></em>. The
pattern contains an underscore or space for each character in the label
text. Any characters omitted are assumed to be spaces. For example, if the
label text is "XXX Label" and the pattern is "___" then only the "XXX" will
be underlined.</p></div><div class="refsect2" title="gtk.Label.set_line_wrap"><a name="method-gtklabel--set-line-wrap"></a><h3>gtk.Label.set_line_wrap</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_line_wrap</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>wrap</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>wrap</code></strong> :</span></p></td><td>if True the label lines will wrap if too big
for the widget size.</td></tr></tbody></table><p>The <code class="methodname">set_wrap</code>() method sets the "wrap"
property tot he value of <em class="parameter"><code>wrap</code></em>. If
<em class="parameter"><code>wrap</code></em> is <code class="literal">True</code> the label text will
wrap if it is wider than the widget size; otherwise, the text gets cut off
at the edge of the widget.</p></div><div class="refsect2" title="gtk.Label.get_line_wrap"><a name="method-gtklabel--get-line-wrap"></a><h3>gtk.Label.get_line_wrap</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_line_wrap</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td><code class="literal">True</code> if the lines of the
label are automatically wrapped.</td></tr></tbody></table><p>The <code class="methodname">get_line_wrap</code>() method returns the
value of the "wrap" property. If "wrap" is <code class="literal">True</code> the lines
in the label are automatically wrapped. See <a class="link" href="class-gtklabel.html#method-gtklabel--set-line-wrap" title="gtk.Label.set_line_wrap"><code class="methodname">set_line_wrap</code>()</a>.</p></div><div class="refsect2" title="gtk.Label.set_selectable"><a name="method-gtklabel--set-selectable"></a><h3>gtk.Label.set_selectable</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_selectable</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>setting</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>setting</code></strong> :</span></p></td><td>if <code class="literal">True</code> allow the text in
the label to be selected</td></tr></tbody></table><p>The <code class="methodname">set_selectable</code>() method sets the
"selectable" property with the value of <em class="parameter"><code>setting</code></em>. If
<em class="parameter"><code>setting</code></em> is <code class="literal">True</code> the user is
allowed to select text from the label, for copy-and-paste.</p></div><div class="refsect2" title="gtk.Label.get_selectable"><a name="method-gtklabel--get-selectable"></a><h3>gtk.Label.get_selectable</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_selectable</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td><code class="literal">True</code> if the user can select
the label text</td></tr></tbody></table><p>The <code class="methodname">get_selectable</code>() method gets the
value of the "selectable" property set by the <a class="link" href="class-gtklabel.html#method-gtklabel--set-selectable" title="gtk.Label.set_selectable"><code class="methodname">set_selectable</code>()</a>
method.</p></div><div class="refsect2" title="gtk.Label.select_region"><a name="method-gtklabel--select-region"></a><h3>gtk.Label.select_region</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">select_region</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>start_offset</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>end_offset</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>start_offset</code></strong> :</span></p></td><td>start offset in characters</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>end_offset</code></strong> :</span></p></td><td>end offset in characters</td></tr></tbody></table><p>The <code class="methodname">select_region</code>() method selects a
range of characters in the label, if the label is selectable. The selected
region is the range of characters between
<em class="parameter"><code>start_offset</code></em> and <em class="parameter"><code>end_offset</code></em>.
See <a class="link" href="class-gtklabel.html#method-gtklabel--set-selectable" title="gtk.Label.set_selectable"><code class="methodname">set_selectable</code>()</a>.
If the label is not selectable, this method has no effect. If
<em class="parameter"><code>start_offset</code></em> or <em class="parameter"><code>end_offset</code></em> are
-1, then the end of the label will be substituted.</p></div><div class="refsect2" title="gtk.Label.get_selection_bounds"><a name="method-gtklabel--get-selection-bounds"></a><h3>gtk.Label.get_selection_bounds</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_selection_bounds</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a tuple containing the start and end character
offsets of the selection</td></tr></tbody></table><p>The <code class="methodname">get_selection_bounds</code>() method
returns a tuple that contains the start and end character offsets of the
selected text in the label if the selection exists. If there is no selection
or the label is not selectable, an empty tuple is returned.</p></div><div class="refsect2" title="gtk.Label.get_layout"><a name="method-gtklabel--get-layout"></a><h3>gtk.Label.get_layout</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_layout</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the <a class="link" href="class-pangolayout.html" title="pango.Layout"><code class="classname">pango.Layout</code></a> for
this label</td></tr></tbody></table><p>The <code class="methodname">get_layout</code>() method returns the
<a class="link" href="class-pangolayout.html" title="pango.Layout"><code class="classname">pango.Layout</code></a>
used to display the label. The layout is useful to e.g. convert text
positions to pixel positions, in combination with <a class="link" href="class-gtklabel.html#method-gtklabel--get-layout-offsets" title="gtk.Label.get_layout_offsets"><code class="methodname">get_layout_offsets</code>()</a>.</p></div><div class="refsect2" title="gtk.Label.get_layout_offsets"><a name="method-gtklabel--get-layout-offsets"></a><h3>gtk.Label.get_layout_offsets</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_layout_offsets</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a tuple containing the X offset of the layout,
or <code class="literal">None</code> and the Y offset of layout, or
<code class="literal">None</code></td></tr></tbody></table><p>The <code class="methodname">get_layout_offsets</code>() method returns
a tuple containing the coordinates where the label will draw the <a class="link" href="class-pangolayout.html" title="pango.Layout"><code class="classname">pango.Layout</code></a>
representing the text in the label. This method is useful for converting
mouse events into coordinates inside the <a class="link" href="class-pangolayout.html" title="pango.Layout"><code class="classname">pango.Layout</code></a>, e.g.
to take some action if some part of the label is clicked. Of course you will
need to create a <a class="link" href="class-gtkeventbox.html" title="gtk.EventBox"><code class="classname">gtk.EventBox</code></a> to
receive the events, and pack the label inside it, since labels are a
"windowless" (<code class="literal">gtk.NO_WINDOW</code>) widget. Remember when using
the <a class="link" href="class-pangolayout.html" title="pango.Layout"><code class="classname">pango.Layout</code></a>
functions you need to convert to and from pixels using
<code class="function">pango.PIXELS()</code> or
<code class="literal">pango.SCALE</code>.</p></div><div class="refsect2" title="gtk.Label.set_ellipsize"><a name="method-gtklabel--set-ellipsize"></a><h3>gtk.Label.set_ellipsize</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_ellipsize</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>mode</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>mode</code></strong> :</span></p></td><td>one of the <a class="xref" href="pango-constants.html#pango-ellipsize-mode-constants" title="Pango Ellipsize Mode Constants">Pango Ellipsize Mode Constants</a> to
use</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.6 and above.</p></div><p>The <code class="methodname">set_ellipsize</code>() method sets the
"ellipsize" property to the value of
<em class="parameter"><code>mode</code></em>. <em class="parameter"><code>mode</code></em> should be one of
the <a class="xref" href="pango-constants.html#pango-ellipsize-mode-constants" title="Pango Ellipsize Mode Constants">Pango Ellipsize Mode Constants</a>. The "ellipsize"
property specifies if and where an ellipse should be used if there is not
enough room for the label text.</p></div><div class="refsect2" title="gtk.Label.get_ellipsize"><a name="method-gtklabel--get-ellipsize"></a><h3>gtk.Label.get_ellipsize</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_ellipsize</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the current ellipsize mode</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.6 and above.</p></div><p>The <code class="methodname">get_ellipsize</code>() method returns the
value of the "ellipsize" property which contains one of the <a class="xref" href="pango-constants.html#pango-ellipsize-mode-constants" title="Pango Ellipsize Mode Constants">Pango Ellipsize Mode Constants</a>. The "ellipsize"
property specifies if and where an ellipse should be used if there is not
enough room for the label text.</p></div><div class="refsect2" title="gtk.Label.set_width_chars"><a name="method-gtklabel--set-width-chars"></a><h3>gtk.Label.set_width_chars</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_width_chars</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>n_chars</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>n_chars</code></strong> :</span></p></td><td> the new desired width, in
characters.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.6 and above.</p></div><p>The <code class="methodname">set_width_chars</code>() method sets the
"width-chars" property to the value of <em class="parameter"><code>n_chars</code></em>. The
"width-chars" property specifies the desired width of the label in
characters.</p></div><div class="refsect2" title="gtk.Label.get_width_chars"><a name="method-gtklabel--get-width-chars"></a><h3>gtk.Label.get_width_chars</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_width_chars</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the desired width of the label in
characters.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.6 and above.</p></div><p>The <code class="methodname">get_width_chars</code>() method returns
the value of the "width-chars" property that specifies the desired width of
the label in characters.</p></div><div class="refsect2" title="gtk.Label.set_single_line_mode"><a name="method-gtklabel--set-single-line-mode"></a><h3>gtk.Label.set_single_line_mode</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_single_line_mode</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>single_line_mode</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>single_line_mode</code></strong> :</span></p></td><td>if <code class="literal">True</code> the label is in
single line mode.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.6 and above.</p></div><p>The <code class="methodname">set_single_line_mode</code>() method sets
the "single-line-mode" property to the value of
<em class="parameter"><code>single_line_mode</code></em>. If
<em class="parameter"><code>single_line_mode</code></em> is <code class="literal">True</code> the label
is in single line mode where the height of the label does not depend on the
actual text, it is always set to ascent + descent of the font.</p></div><div class="refsect2" title="gtk.Label.get_single_line_mode"><a name="method-gtklabel--get-single-line-mode"></a><h3>gtk.Label.get_single_line_mode</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_single_line_mode</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td></td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.6 and above.</p></div><p>The <code class="methodname">get_single_line_mode</code>() method
returns the value of the "single-line-mode" property. See the <a class="link" href="class-gtklabel.html#method-gtklabel--set-single-line-mode" title="gtk.Label.set_single_line_mode"><code class="methodname">set_single_line_mode</code>()</a>
method for more information.</p></div><div class="refsect2" title="gtk.Label.set_max_width_chars"><a name="method-gtklabel--set-max-width-chars"></a><h3>gtk.Label.set_max_width_chars</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_max_width_chars</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>n_chars</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>n_chars</code></strong> :</span></p></td><td> the new desired maximum width, in
characters.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.6 and above.</p></div><p>The <code class="methodname">set_max_width_chars</code>() method sets
the "max-width-chars" property to the value of
<em class="parameter"><code>n_chars</code></em>.</p></div><div class="refsect2" title="gtk.Label.get_max_width_chars"><a name="method-gtklabel--get-max-width-chars"></a><h3>gtk.Label.get_max_width_chars</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_max_width_chars</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td></td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.6 and above.</p></div><p>The <code class="methodname">get_max_width_chars</code>() method
returns the value of the "max-width-chars" property which is the desired
maximum width of the label in characters.</p></div><div class="refsect2" title="gtk.Label.set_angle"><a name="method-gtklabel--set-angle"></a><h3>gtk.Label.set_angle</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_angle</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>angle</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>angle</code></strong> :</span></p></td><td> the angle that the baseline of the label makes
with the horizontal, in degrees, measured counterclockwise</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.6 and above.</p></div><p>The <code class="methodname">set_angle</code>() method sets the "angle"
property to the value of
<em class="parameter"><code>angle</code></em>. <em class="parameter"><code>angle</code></em> is the angle of
rotation for the label. An angle of 90 reads from from bottom to top, an
angle of 270, from top to bottom. The angle setting for the label is ignored
if the label is selectable, wrapped, or ellipsized.</p></div><div class="refsect2" title="gtk.Label.get_angle"><a name="method-gtklabel--get-angle"></a><h3>gtk.Label.get_angle</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_angle</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td></td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.6 and above.</p></div><p>The <code class="methodname">get_angle</code>() method returns the
value of the "angle" property. See the <a class="link" href="class-gtklabel.html#method-gtklabel--set-angle" title="gtk.Label.set_angle"><code class="methodname">set_angle</code>()</a>
method for more information.</p></div><div class="refsect2" title="gtk.Label.get_current_uri"><a name="method-gtklabel--get-current-uri"></a><h3>gtk.Label.get_current_uri</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_current_uri</span>(<span class="methodparam"></span>)</code></pre><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.22 and above.</p></div><p>The <code class="methodname">get_current_uri</code>() method returns the URI for the
currently active link in the label. The active link is the one under the mouse pointer
or, in a selectable label, the link in which the text cursor is currently positioned.</p><p>This function is intended for use in a "activate-link" handler or for use in a
"query-tooltip" handler.</p></div><div class="refsect2" title="gtk.Label.set_track_visited_links"><a name="method-gtklabel--set-track-visited-links"></a><h3>gtk.Label.set_track_visited_links</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_track_visited_links</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>track_links</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>track_links</code></strong> :</span></p></td><td><code class="literal">True</code> to track visited links, <code class="literal">False</code> otherwise.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.22 and above.</p></div><p>The <code class="methodname">set_track_visited_links</code>() method sets
whether the label should keep track of clicked links (and use a different color for them).</p></div><div class="refsect2" title="gtk.Label.get_track_visited_links"><a name="method-gtklabel--get-track-visited-links"></a><h3>gtk.Label.get_track_visited_links</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_track_visited_links</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td><code class="literal">True</code> if clicked links are remembered, <code class="literal">False</code> otherwise.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.22 and above.</p></div><p>The <code class="methodname">get_track_visited_links</code>() method returns
whether the label is currently keeping track of clicked links.</p></div><div class="refsect2" title="gtk.Label.set_line_wrap_mode"><a name="method-gtklabel--set-line-wrap-mode"></a><h3>gtk.Label.set_line_wrap_mode</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_line_wrap_mode</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>wrap_mode</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>wrap_mode</code></strong> :</span></p></td><td>the line wrapping mode.</td></tr></tbody></table><p>The <code class="methodname">set_line_wrap_mode</code>() method controls how line
wrapping is done (if it is enabled, see
<a class="link" href="class-gtklabel.html#method-gtklabel--set-line-wrap" title="gtk.Label.set_line_wrap"><code class="methodname">refetch</code></a>()).
The default is <code class="literal">pango.WRAP_WORD</code> which means wrap on word boundaries.</p></div><div class="refsect2" title="gtk.Label.get_line_wrap_mode"><a name="method-gtklabel--get-line-wrap-mode"></a><h3>gtk.Label.get_line_wrap_mode</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_line_wrap_mode</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td><code class="literal">True</code> if the lines of the label are automatically wrapped.</td></tr></tbody></table><p>The <code class="methodname">get_line_wrap_mode</code>() method returns
the line wrap mode used by the label.</p></div></div><div class="refsect1" title="Signals"><a name="id3777004"></a><h2>Signals</h2><div class="refsect2" title='The "activate-current-link" gtk.Label Signal'><a name="signal-gtklabel--activate-current-link"></a><h3>The "activate-current-link" gtk.Label Signal</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>label</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><em class="parameter"><code>label</code></em> :</span></p></td><td>the label that received the signal</td></tr><tr><td><p><span class="term"><em class="parameter"><code>user_param1</code></em> :</span></p></td><td>the first user parameter (if any) specified with the <PYGTKDOCLINK HREF="method-gobject--connect"><code class="methodname">connect</code>()</PYGTKDOCLINK> method</td></tr><tr><td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td><td>additional user parameters (if any)</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This signal is available in GTK+ 2.18 and above.</p></div><p>The "activate-current-link" is a "keybinding signal" signal which gets emitted when the user activates a link in the label.</p></div><div class="refsect2" title='The "activate-link" gtk.Label Signal'><a name="signal-gtklabel--activate-link"></a><h3>The "activate-link" gtk.Label Signal</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>label</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>uri</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><em class="parameter"><code>label</code></em> :</span></p></td><td>the label that received the signal</td></tr><tr><td><p><span class="term"><em class="parameter"><code>uri</code></em> :</span></p></td><td>the URI that is activated</td></tr><tr><td><p><span class="term"><em class="parameter"><code>user_param1</code></em> :</span></p></td><td>the first user parameter (if any) specified with the <PYGTKDOCLINK HREF="method-gobject--connect"><code class="methodname">connect</code>()</PYGTKDOCLINK> method</td></tr><tr><td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td><td>additional user parameters (if any)</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This signal is available in GTK+ 2.18 and above.</p></div><p>The "activate-link" signal is emitted to activate a URI. Applications may connect to it to override the default behaviour,
which is to call <code class="methodname"><a class="link" href="gtk-functions.html#function-gtk--show-uri" title="gtk.show_uri">gtk.show_uri</a></code>().</p></div><div class="refsect2" title='The "copy-clipboard" gtk.Label Signal'><a name="signal-gtklabel--copy-clipboard"></a><h3>The "copy-clipboard" gtk.Label Signal</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>label</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><em class="parameter"><code>label</code></em> :</span></p></td><td>the label that received the
signal</td></tr><tr><td><p><span class="term"><em class="parameter"><code>user_param1</code></em> :</span></p></td><td>the first user parameter (if any) specified
with the <PYGTKDOCLINK HREF="method-gobject--connect"><code class="methodname">connect</code>()</PYGTKDOCLINK>
method</td></tr><tr><td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td><td>additional user parameters (if
any)</td></tr></tbody></table><p>The "copy-clipboard" signal is emitted when text is copied from
the label to the clipboard.</p></div><div class="refsect2" title='The "move-cursor" gtk.Label Signal'><a name="signal-gtklabel--move-cursor"></a><h3>The "move-cursor" gtk.Label Signal</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>label</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>step</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>count</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>extend_selection</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><em class="parameter"><code>label</code></em> :</span></p></td><td>the label that received the
signal</td></tr><tr><td><p><span class="term"><em class="parameter"><code>step</code></em> :</span></p></td><td>the step size of the move:
<code class="literal">gtk.MOVEMENT_LOGICAL_POSITIONS</code>,
<code class="literal">gtk.MOVEMENT_VISUAL_POSITIONS</code>,
<code class="literal">gtk.MOVEMENT_WORDS</code>,
<code class="literal">gtk.MOVEMENT_DISPLAY_LINES</code>,
<code class="literal">gtk.MOVEMENT_DISPLAY_LINE_ENDS</code>,
<code class="literal">gtk.MOVEMENT_PARAGRAPHS</code>,
<code class="literal">gtk.MOVEMENT_PARAGRAPH_ENDS</code>,
<code class="literal">gtk.MOVEMENT_PAGES</code> and
<code class="literal">gtk.MOVEMENT_BUFFER_ENDS</code></td></tr><tr><td><p><span class="term"><em class="parameter"><code>count</code></em> :</span></p></td><td>the number of steps to
take</td></tr><tr><td><p><span class="term"><em class="parameter"><code>extend_selection</code></em> :</span></p></td><td>if <code class="literal">True</code> extend the range of
the selection</td></tr><tr><td><p><span class="term"><em class="parameter"><code>user_param1</code></em> :</span></p></td><td>the first user parameter (if any) specified
with the <PYGTKDOCLINK HREF="method-gobject--connect"><code class="methodname">connect</code>()</PYGTKDOCLINK>
method</td></tr><tr><td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td><td>additional user parameters (if
any)</td></tr></tbody></table><p>The "move-cursor" signal is emitted when the cursor is being
moved <em class="parameter"><code>count</code></em> steps or size <code class="literal">step</code>.
The step size is one of:</p><pre class="programlisting">
gtk.MOVEMENT_LOGICAL_POSITIONS, move by graphemes
gtk.MOVEMENT_VISUAL_POSITIONS, move by graphemes
gtk.MOVEMENT_WORDS, move by words
gtk.MOVEMENT_DISPLAY_LINES, move by lines(wrapped lines)
gtk.MOVEMENT_DISPLAY_LINE_ENDS, move to line ends(wrapped lines)
gtk.MOVEMENT_PARAGRAPHS, move by paragraphs(newline-ended lines)
gtk.MOVEMENT_PARAGRAPH_ENDS, move to ends of a paragraph
gtk.MOVEMENT_PAGES, move by pages
gtk.MOVEMENT_BUFFER_ENDS move to ends of the buffer
</pre><p>If <em class="parameter"><code>extend_selection</code></em> is
<code class="literal">True</code> the selection will be extended to include the text
moved over.</p></div><div class="refsect2" title='The "populate-popup" gtk.Label Signal'><a name="signal-gtklabel--populate-popup"></a><h3>The "populate-popup" gtk.Label Signal</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>label</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>menu</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><em class="parameter"><code>label</code></em> :</span></p></td><td>the label that received the
signal</td></tr><tr><td><p><span class="term"><em class="parameter"><code>menu</code></em> :</span></p></td><td>the menu to be populated</td></tr><tr><td><p><span class="term"><em class="parameter"><code>user_param1</code></em> :</span></p></td><td>the first user parameter (if any) specified
with the <PYGTKDOCLINK HREF="method-gobject--connect"><code class="methodname">connect</code>()</PYGTKDOCLINK>
method</td></tr><tr><td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td><td>additional user parameters (if
any)</td></tr></tbody></table><p>The "populate-popup" signal is emitted when a menu needs to be
populated on the fly.</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-gtkitemfactory.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="gtk-class-reference.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="class-gtklayout.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">gtk.ItemFactory </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> gtk.Layout</td></tr></table></div></body></html>
|