/usr/share/gtk-doc/html/pygtk/class-gtktogglebutton.html is in python-gtk2-doc 2.24.0-4ubuntu1.
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 | <html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>gtk.ToggleButton</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-gtktoggleaction.html" title="gtk.ToggleAction"><link rel="next" href="class-gtktoggletoolbutton.html" title="gtk.ToggleToolButton"></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.ToggleButton</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-gtktoggleaction.html">Prev</a> </td><th width="60%" align="center">The gtk Class Reference</th><td width="20%" align="right"> <a accesskey="n" href="class-gtktoggletoolbutton.html">Next</a></td></tr></table><hr></div><div class="refentry" title="gtk.ToggleButton"><a name="class-gtktogglebutton"></a><div class="titlepage"></div><div class="refnamediv"><h2>gtk.ToggleButton</h2><p>gtk.ToggleButton — a button that retains its state</p></div><div class="refsect1" title="Synopsis"><a name="id3985044"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gtk.ToggleButton</span></span>(<span class="ooclass"><span class="classname"><a class="link" href="class-gtkbutton.html" title="gtk.Button">gtk.Button</a></span></span>):
<code class="constructorsynopsis"> <span class="methodname"><a class="link" href="class-gtktogglebutton.html#constructor-gtktogglebutton" title="Constructor">gtk.ToggleButton</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>label</code></strong></span><span class="initializer">=None</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>use_underline</code></strong></span><span class="initializer">=True</span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtktogglebutton.html#method-gtktogglebutton--set-mode" title="gtk.ToggleButton.set_mode">set_mode</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>draw_indicator</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtktogglebutton.html#method-gtktogglebutton--get-mode" title="gtk.ToggleButton.get_mode">get_mode</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtktogglebutton.html#method-gtktogglebutton--set-active" title="gtk.ToggleButton.set_active">set_active</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>is_active</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtktogglebutton.html#method-gtktogglebutton--get-active" title="gtk.ToggleButton.get_active">get_active</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtktogglebutton.html#method-gtktogglebutton--toggled" title="gtk.ToggleButton.toggled">toggled</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtktogglebutton.html#method-gtktogglebutton--set-inconsistent" title="gtk.ToggleButton.set_inconsistent">set_inconsistent</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-gtktogglebutton.html#method-gtktogglebutton--get-inconsistent" title="gtk.ToggleButton.get_inconsistent">get_inconsistent</a></span>(<span class="methodparam"></span>)</code><br></pre></td></tr></table></div><div class="refsect1" title="Ancestry"><a name="id3985286"></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-gtkcontainer.html" title="gtk.Container">gtk.Container</a>
+-- <a class="link" href="class-gtkbin.html" title="gtk.Bin">gtk.Bin</a>
+-- <a class="link" href="class-gtkbutton.html" title="gtk.Button">gtk.Button</a>
+-- <a class="link" href="class-gtktogglebutton.html" title="gtk.ToggleButton">gtk.ToggleButton</a>
</pre></div><div class="refsect1" title="Implemented Interfaces"><a name="id3985343"></a><h2>Implemented Interfaces</h2><p>
<a class="link" href="class-gtktogglebutton.html" title="gtk.ToggleButton"><code class="classname">gtk.ToggleButton</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.ToggleButton Properties"><a name="properties-gtktogglebutton"></a><h2>gtk.ToggleButton 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-gtkcontainer.html#properties-gtkcontainer" title="gtk.Container Properties">gtk.Container Properties</a></p><p><a class="link" href="class-gtkbutton.html#properties-gtkbutton" title="gtk.Button Properties">gtk.Button 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">"active"</td><td valign="top">Read-Write</td><td valign="top">If <code class="literal">True</code>, the toggle button should be
pressed in.</td></tr><tr valign="top"><td valign="top">"draw-indicator"</td><td valign="top">Read-Write</td><td valign="top">If <code class="literal">True</code>, the toggle part of the
button is displayed.</td></tr><tr valign="top"><td valign="top">"inconsistent"</td><td valign="top">Read-Write</td><td valign="top">If <code class="literal">True</code>, the toggle button is in an
"in between" state.</td></tr></tbody></table></div></td></tr></table></div></div><div class="refsect1" title="gtk.ToggleButton Style Properties"><a name="style-properties-gtktogglebutton"></a><h2>gtk.ToggleButton 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><p><a class="link" href="class-gtkbutton.html#style-properties-gtkbutton" title="gtk.Button Style Properties">gtk.Button Style Properties</a></p></div><div class="refsect1" title="Attributes"><a name="id3985556"></a><h2>Attributes</h2><div class="blockquote"><table width="100%" border="0" bgcolor="#E0E0E0"><tr><td valign="top"><div class="informaltable"><table cellpadding="5" width="100%" border="0"><colgroup><col width="1in"><col width="1in"><col width="4in"></colgroup><tbody><tr valign="top"><td valign="top">"draw_indicator"</td><td valign="top">Read</td><td valign="top">If <code class="literal">True</code>, the toggle part of the
button is displayed.</td></tr></tbody></table></div></td></tr></table></div></div><div class="refsect1" title="gtk.ToggleButton Signal Prototypes"><a name="signal-prototypes-gtktogglebutton"></a><h2>gtk.ToggleButton 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><p><a class="link" href="class-gtkcontainer.html#signal-prototypes-gtkcontainer" title="gtk.Container Signal Prototypes">gtk.Container Signal Prototypes</a></p><p><a class="link" href="class-gtkbutton.html#signal-prototypes-gtkbutton" title="gtk.Button Signal Prototypes">gtk.Button 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-gtktogglebutton.html#signal-gtktogglebutton--toggled" title='The "toggled" gtk.ToggleButton Signal'>toggled</a>"</span></p></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>togglebutton</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="id3985751"></a><h2>Description</h2><p>A <a class="link" href="class-gtktogglebutton.html" title="gtk.ToggleButton"><code class="classname">gtk.ToggleButton</code></a>
is a <a class="link" href="class-gtkbutton.html" title="gtk.Button"><code class="classname">gtk.Button</code></a> that has
two stable states: 'pressed-in' ("on" or "active") and "normal" ("off" or
"inactive"). The state changes to the alternate state each time the
togglebutton is clicked. The state of a <a class="link" href="class-gtktogglebutton.html" title="gtk.ToggleButton"><code class="classname">gtk.ToggleButton</code></a>
can be set specifically using the <a class="link" href="class-gtktogglebutton.html#method-gtktogglebutton--set-active" title="gtk.ToggleButton.set_active"><code class="methodname">set_active</code>()</a>
method, and retrieved using the <a class="link" href="class-gtktogglebutton.html#method-gtktogglebutton--get-active" title="gtk.ToggleButton.get_active"><code class="methodname">get_active</code>()</a>
method. To simply switch the state of a toggle button, use the <a class="link" href="class-gtktogglebutton.html#method-gtktogglebutton--toggled" title="gtk.ToggleButton.toggled"><code class="methodname">toggled</code>()</a>
method.</p></div><div class="refsect1" title="Constructor"><a name="constructor-gtktogglebutton"></a><h2>Constructor</h2><pre class="programlisting"><code class="constructorsynopsis"> <span class="methodname">gtk.ToggleButton</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>label</code></strong></span><span class="initializer">=None</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>use_underline</code></strong></span><span class="initializer">=True</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>label</code></strong> :</span></p></td><td>the text to be displayed by the button label
including an underscore to indicate the mnemonic character if desired or
<code class="literal">None</code> if no label is required.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>use_underline</code></strong> :</span></p></td><td>if <code class="literal">True</code>, an underscore in the
label text indicates the next character should be underlined and used for the
mnemonic accelerator key if it is the first character so
marked. Available in PyGTK 2.4 and above.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a new <a class="link" href="class-gtktogglebutton.html" title="gtk.ToggleButton"><code class="classname">gtk.ToggleButton</code></a>
widget</td></tr></tbody></table><p>Creates a new <a class="link" href="class-gtktogglebutton.html" title="gtk.ToggleButton"><code class="classname">gtk.ToggleButton</code></a>
widget with the text label specified by <em class="parameter"><code>label</code></em>.
<em class="parameter"><code>label</code></em> will be parsed for underscore characters that
indicate mnemonic accelerators. If <em class="parameter"><code>label</code></em> is
<code class="literal">None</code> or not specified, no label will be created.</p><p>In PyGTK 2.4 and above the <em class="parameter"><code>use_underline</code></em>
parameter is available and defaults to <code class="literal">True</code>. If
<em class="parameter"><code>use_underline</code></em> is set to <code class="literal">False</code> the
label text will not be parsed for mnemonic characters.</p></div><div class="refsect1" title="Methods"><a name="id3986025"></a><h2>Methods</h2><div class="refsect2" title="gtk.ToggleButton.set_mode"><a name="method-gtktogglebutton--set-mode"></a><h3>gtk.ToggleButton.set_mode</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_mode</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>draw_indicator</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>draw_indicator</code></strong> :</span></p></td><td>if <code class="literal">True</code> display the button
as an indicator with a label; if <code class="literal">False</code> just display as a
normal button</td></tr></tbody></table><p>The <code class="methodname">set_mode</code>() method sets the
"draw-indicator" property to the value of<em class="parameter"><code>
draw_indicator</code></em>. If <em class="parameter"><code>draw_indicator</code></em> is
<code class="literal">True</code> the button is displayed as an indicator with a
label; otherwise, the button is displayed as a normal button.</p><p>This method only affects subclasses of <a class="link" href="class-gtktogglebutton.html" title="gtk.ToggleButton"><code class="classname">gtk.ToggleButton</code></a>
like <a class="link" href="class-gtkcheckbutton.html" title="gtk.CheckButton"><code class="classname">gtk.CheckButton</code></a>
and <a class="link" href="class-gtkradiobutton.html" title="gtk.RadioButton"><code class="classname">gtk.RadioButton</code></a>.</p></div><div class="refsect2" title="gtk.ToggleButton.get_mode"><a name="method-gtktogglebutton--get-mode"></a><h3>gtk.ToggleButton.get_mode</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_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 button is
displayed as an indicator with a label; <code class="literal">False</code> if
displayed as a normal button.</td></tr></tbody></table><p>The <code class="methodname">get_mode</code>() method returns the value
of the "draw-indicator" property. If "draw-indicator" is
<code class="literal">True</code> the button is displayed as an indicator with a
label; if <code class="literal">False</code>, the button is displayed as a normal
button. See the <a class="link" href="class-gtktogglebutton.html#method-gtktogglebutton--set-mode" title="gtk.ToggleButton.set_mode"><code class="methodname">set_mode</code>()</a>
method.</p></div><div class="refsect2" title="gtk.ToggleButton.set_active"><a name="method-gtktogglebutton--set-active"></a><h3>gtk.ToggleButton.set_active</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_active</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>is_active</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>is_active</code></strong> :</span></p></td><td>if <code class="literal">True</code> the togglebutton
state is active ("on")</td></tr></tbody></table><p>The <code class="methodname">set_active</code>() method sets the
"active" property to the value of <em class="parameter"><code>is_active</code></em>. If
<em class="parameter"><code>is_active</code></em> is <code class="literal">True</code> the <a class="link" href="class-gtktogglebutton.html" title="gtk.ToggleButton"><code class="classname">gtk.ToggleButton</code></a>
is 'pressed in', and if <code class="literal">False</code> it's 'normal'. This method
causes the "toggled" signal to be emitted.</p></div><div class="refsect2" title="gtk.ToggleButton.get_active"><a name="method-gtktogglebutton--get-active"></a><h3>gtk.ToggleButton.get_active</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_active</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>True if the togglebutton is
active</td></tr></tbody></table><p>The <code class="methodname">get_active</code>() method returns the
value of the "active" property. If "active" is <code class="literal">True</code> the
togglebutton is 'pressed in'; if <code class="literal">False</code>, it's
'normal'.</p></div><div class="refsect2" title="gtk.ToggleButton.toggled"><a name="method-gtktogglebutton--toggled"></a><h3>gtk.ToggleButton.toggled</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">toggled</span>(<span class="methodparam"></span>)</code></pre><p>The <code class="methodname">toggled</code>() method emits the
"toggled" signal on the togglebutton.</p></div><div class="refsect2" title="gtk.ToggleButton.set_inconsistent"><a name="method-gtktogglebutton--set-inconsistent"></a><h3>gtk.ToggleButton.set_inconsistent</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_inconsistent</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 state is
inconsistent</td></tr></tbody></table><p>The <code class="methodname">set_inconsistent</code>() method sets the
"inconsistent" 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> the togglebutton
is displayed in the inconsistent state - an "in between" state. This method
is useful if the user has selected a range of elements (such as some text or
spreadsheet cells) that are affected by a toggle button, and the current
values in that range are inconsistent and you want to indicate that by
setting the toggle button to an "in between" display. Normally you would
turn off the inconsistent state again if the user clicks the toggle
button.</p></div><div class="refsect2" title="gtk.ToggleButton.get_inconsistent"><a name="method-gtktogglebutton--get-inconsistent"></a><h3>gtk.ToggleButton.get_inconsistent</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_inconsistent</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 state is
inconsistent</td></tr></tbody></table><p>The <code class="methodname">get_inconsistent</code>() method returns
the value of the "inconsistent" property. If "inconsistent" is
<code class="literal">True</code> the togglebutton is displayed in an 'in between'
state. See the <a class="link" href="class-gtktogglebutton.html#method-gtktogglebutton--set-inconsistent" title="gtk.ToggleButton.set_inconsistent"><code class="methodname">set_inconsistent</code>()</a>
method for more details.</p></div></div><div class="refsect1" title="Signals"><a name="id3986664"></a><h2>Signals</h2><div class="refsect2" title='The "toggled" gtk.ToggleButton Signal'><a name="signal-gtktogglebutton--toggled"></a><h3>The "toggled" gtk.ToggleButton Signal</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>togglebutton</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>togglebutton</code></em> :</span></p></td><td>the togglebutton 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 "toggled" signal is emitted when the togglebutton state
changes either programmatically or by user action.</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-gtktoggleaction.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-gtktoggletoolbutton.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">gtk.ToggleAction </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> gtk.ToggleToolButton</td></tr></table></div></body></html>
|