summaryrefslogtreecommitdiff
path: root/docs/reference/pygtk-gtkradiobutton.xml
blob: 11e7fb83957ca5381666133f2b1fc30352908f8d (plain)
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
<?xml version="1.0" standalone="no"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
    "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">

<refentry id="class-gtkradiobutton">
  <refnamediv>
    <refname>gtk.RadioButton</refname>
    <refpurpose>a choice of one of multiple check buttons.</refpurpose>
  </refnamediv>

  <refsect1>
    <title>Synopsis</title>

    <classsynopsis language="python">
      <ooclass><classname>gtk.RadioButton</classname></ooclass>
      <ooclass><classname><link
linkend="class-gtkcheckbutton">gtk.CheckButton</link></classname></ooclass>
      <constructorsynopsis language="python">
	<methodname><link
linkend="constructor-gtkradiobutton">gtk.RadioButton</link></methodname>
	<methodparam><parameter
		       role="keyword">group</parameter>
	  <initializer>None</initializer></methodparam>
	<methodparam><parameter
		       role="keyword">label</parameter>
	  <initializer>None</initializer></methodparam>
	<methodparam><parameter role="keyword">use_underline</parameter>
	  <initializer>True</initializer></methodparam>
      </constructorsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkradiobutton--get-group">get_group</link></methodname>
	<methodparam></methodparam>  </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkradiobutton--set-group">set_group</link></methodname>
	<methodparam><parameter
		       role="keyword">group</parameter></methodparam>
      </methodsynopsis>
    </classsynopsis>

  </refsect1>

  <refsect1>
    <title>Ancestry</title>

<synopsis>+-- <link linkend="class-gobject">gobject.GObject</link>
  +-- <link linkend="class-gtkobject">gtk.Object</link>
    +-- <link linkend="class-gtkwidget">gtk.Widget</link>
      +-- <link linkend="class-gtkcontainer">gtk.Container</link>
        +-- <link linkend="class-gtkbin">gtk.Bin</link>
          +-- <link linkend="class-gtkbutton">gtk.Button</link>
            +-- <link linkend="class-gtktogglebutton">gtk.ToggleButton</link>
              +-- <link linkend="class-gtkcheckbutton">gtk.CheckButton</link>
                +-- <link linkend="class-gtkradiobutton">gtk.RadioButton</link>
</synopsis>

  </refsect1>

  <refsect1 id="properties-gtkradiobutton">
    <title>gtk.RadioButton Properties</title>

    <para><link linkend="properties-gtkobject">gtk.Object Properties</link></para>
    <para><link linkend="properties-gtkwidget">gtk.Widget Properties</link></para>
    <para><link linkend="properties-gtkcontainer">gtk.Container Properties</link></para>
    <para><link linkend="properties-gtkbutton">gtk.Button Properties</link></para>
    <para><link linkend="properties-gtktogglebutton">gtk.ToggleButton Properties</link></para>

    <blockquote role="properties">
      <informaltable pgwide="1" frame="none">
	<tgroup cols="3">
	  <colspec column="1" colwidth="1in"/>
	  <colspec column="2" colwidth="1in"/>
	  <colspec column="3" colwidth="4in"/>
	  <tbody>

	    <row valign="top">
	      <entry>"group"</entry>
	      <entry>Write</entry>
	      <entry>The group that the radiobutton is in.</entry>
	    </row>

	  </tbody>
	</tgroup>
      </informaltable>
    </blockquote>

  </refsect1>

  <refsect1 id="style-properties-gtkradiobutton">
    <title>gtk.RadioButton Style Properties</title>

    <para><link linkend="style-properties-gtkwidget">gtk.Widget Style Properties</link></para>
    <para><link linkend="style-properties-gtkbutton">gtk.Button Style Properties</link></para>
    <para><link linkend="style-properties-gtkcheckbutton">gtk.CheckButton Style Properties</link></para>

  </refsect1>

  <refsect1 id="signal-prototypes-gtkradiobutton">
    <title>gtk.RadioButton Signal Prototypes</title>

    <para><link linkend="signal-prototypes-gobject">gobject.GObject Signal Prototypes</link></para>
    <para><link linkend="signal-prototypes-gtkobject">gtk.Object Signal Prototypes</link></para>
    <para><link linkend="signal-prototypes-gtkwidget">gtk.Widget Signal Prototypes</link></para>
    <para><link linkend="signal-prototypes-gtkcontainer">gtk.Container Signal Prototypes</link></para>
    <para><link linkend="signal-prototypes-gtkbutton">gtk.Button Signal Prototypes</link></para>
    <para><link linkend="signal-prototypes-gtktogglebutton">gtk.ToggleButton Signal Prototypes</link></para>

    <variablelist>
      <varlistentry>
        <term>"<link linkend="signal-gtkradiobutton--group-changed">group-changed</link>"</term>
        <listitem>
          <methodsynopsis language="python"><methodname>callback</methodname>
            <methodparam><parameter>radiobutton</parameter></methodparam>
            <methodparam><parameter>user_param1</parameter></methodparam>
            <methodparam><parameter>...</parameter></methodparam>
          </methodsynopsis>
        </listitem>
      </varlistentry>
    </variablelist>

  </refsect1>

  <refsect1>
    <title>Description</title>

    <para>A single <link
linkend="class-gtkradiobutton"><classname>gtk.RadioButton</classname></link>
performs the same basic function as a <link
linkend="class-gtkcheckbutton"><classname>gtk.CheckButton</classname></link>, 
as it's position in the object hierarchy reflects. It is only when multiple
radio buttons are grouped together that they become a different user
interface component in their own right. Every radio button is a member of
some group of radio buttons. When one is selected, all other radio buttons
in the same group are deselected. A <link
linkend="class-gtkradiobutton"><classname>gtk.RadioButton</classname></link>
is used to give the user a choice of one of many options.</para>

    <para>Radio button widgets are created with <link
linkend="constructor-gtkradiobutton">gtk.RadioButton</link>() passing
<literal>None</literal> as the <parameter>group</parameter> (first) argument
if this is the first radio button in a group. In subsequent calls, pass a
reference to a <link
linkend="class-gtkradiobutton"><classname>gtk.RadioButton</classname></link>
as the first argument to specify the group. The second (optional) argument
to <link linkend="constructor-gtkradiobutton">gtk.RadioButton</link>() is a
label that is used to specify the text of the button. The label text is
parsed for mnemonic characters (preceded by an underscore) to specify an
accelerator for the radiobutton. See <link
linkend="class-gtkaccelgroup"><classname>gtk.AccelGroup</classname></link>
and <link
linkend="class-gtkaccellabel"><classname>gtk.AccelLabel</classname></link>
for more information on mnemonic accelerators.</para>

    <para>To retrieve the group a <link
linkend="class-gtkradiobutton"><classname>gtk.RadioButton</classname></link>
is assigned to, use the <link
linkend="method-gtkradiobutton--get-group"><methodname>get_group</methodname>()</link> 
method. To remove a <link
linkend="class-gtkradiobutton"><classname>gtk.RadioButton</classname></link>
from one group and make it part of a new one, use the <link
linkend="method-gtkradiobutton--set-group"><methodname>set_group</methodname>()</link> 
method.</para>

  </refsect1>

  <refsect1 id="constructor-gtkradiobutton">
    <title>Constructor</title>

    <programlisting><constructorsynopsis language="python">
	<methodname>gtk.RadioButton</methodname>
	<methodparam><parameter
		       role="keyword">group</parameter>
	  <initializer>None</initializer></methodparam>
	<methodparam><parameter
		       role="keyword">label</parameter>
	  <initializer>None</initializer></methodparam>
	<methodparam><parameter role="keyword">use_underline</parameter>
	  <initializer>True</initializer></methodparam>
      </constructorsynopsis></programlisting>
    <variablelist>
      <varlistentry>
	<term><parameter role="keyword">group</parameter>&nbsp;:</term>
	<listitem><simpara>an existing <link
linkend="class-gtkradiobutton"><classname>gtk.RadioButton</classname></link>
or <literal>None</literal></simpara></listitem>
      </varlistentry>
      <varlistentry>
	<term><parameter role="keyword">label</parameter>&nbsp;:</term>
	<listitem><simpara>a string to use as the button text or
<literal>None</literal></simpara></listitem>
      </varlistentry>
      <varlistentry>
	<term><parameter role="keyword">use_underline</parameter>&nbsp;:</term>
	<listitem><simpara>if <literal>True</literal>, 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.</simpara></listitem>
      </varlistentry>
      <varlistentry>
	<term><emphasis>Returns</emphasis>&nbsp;:</term>
	<listitem><simpara>a new <link
linkend="class-gtkradiobutton"><classname>gtk.RadioButton</classname></link>
widget</simpara></listitem>
      </varlistentry>
    </variablelist>

    <para>Creates a new <link
linkend="class-gtkradiobutton"><classname>gtk.RadioButton</classname></link>
widget with the label text specified by <parameter>label</parameter>, adding
it to the same group as <parameter>group</parameter>.
<parameter>label</parameter> is parsed for underscore characters that
indicate mnemonic accelerators. If <parameter>label</parameter> is
<literal>None</literal>, no label is created. If
<parameter>group</parameter> is <literal>None</literal>, the new radiobutton
becomes the first member of a new radiobutton group.</para>

    <para>In PyGTK 2.4 and above the <parameter>use_underline</parameter>
parameter is available and defaults to <literal>True</literal>. If
<parameter>use_underline</parameter> is set to <literal>False</literal> the
label text will not be parsed for mnemonic characters.</para>

  </refsect1>

  <refsect1>
    <title>Methods</title>

    <refsect2 id="method-gtkradiobutton--get-group">
      <title>gtk.RadioButton.get_group</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_group</methodname>
	  <methodparam></methodparam>  </methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the list of radiobuttons in the same group that
contains the radiobutton or <literal>None</literal></simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>get_group</methodname>() method returns the list
of radiobuttons that are in the same group as the radiobutton or
<literal>None</literal> if the radiobutton is not in a group.</para>

    </refsect2>

    <refsect2 id="method-gtkradiobutton--set-group">
      <title>gtk.RadioButton.set_group</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_group</methodname>
	  <methodparam><parameter
		       role="keyword">group</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">group</parameter>&nbsp;:</term>
	  <listitem><simpara>a <link
	  linkend="class-gtkradiobutton"><classname>gtk.RadioButton</classname></link>
	  whose group the radiobutton will be added to or
<literal>None</literal></simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>set_group</methodname>() method adds the
radiobutton to the group of the radiobutton specified by
<parameter>group</parameter>.</para>

      <para>In PyGTK 2.6.2 and above, if <parameter>group</parameter> is
<literal>None</literal> the radiobutton is removed from its current
group.</para>

    </refsect2>

  </refsect1>

  <refsect1>
    <title>Signals</title>

    <refsect2 id="signal-gtkradiobutton--group-changed">
      <title>The "group-changed" gtk.RadioButton Signal</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>callback</methodname>
	  <methodparam><parameter>radiobutton</parameter></methodparam>
	  <methodparam><parameter>user_param1</parameter></methodparam>
	  <methodparam><parameter>...</parameter></methodparam>
	</methodsynopsis></programlisting>

      <variablelist>
	<varlistentry>
	  <term><parameter>radiobutton</parameter>&nbsp;:</term>
	  <listitem><simpara>the radiobutton that received the
signal</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter>user_param1</parameter>&nbsp;:</term>
          <listitem><simpara>the first user parameter (if any) specified
with the <link
linkend="method-gobject--connect"><methodname>connect</methodname>()</link>
method</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter>...</parameter>&nbsp;:</term>
	  <listitem><simpara>additional user parameters (if
any)</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
	<para>This signal is available in GTK+ 2.4 and above.</para>
      </note>

      <para>The "group-changed" signal is emitted when a <link
linkend="class-gtkradiobutton"><classname>gtk.RadioButton</classname></link>
is added to or removed from the group.</para>

    </refsect2>

  </refsect1>

</refentry>