File: class-gtksizegroup.html

package info (click to toggle)
python-gtk2-doc 2.5.2-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 8,304 kB
  • ctags: 3,741
  • sloc: makefile: 38
file content (61 lines) | stat: -rw-r--r-- 14,126 bytes parent folder | download
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
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>gtk.SizeGroup</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="PyGTK 2.0 Reference Manual"><link rel="up" href="gtk-class-reference.html" title="The gtk Class Reference"><link rel="previous" href="class-gtksettings.html" title="gtk.Settings"><link rel="next" href="class-gtksocket.html" title="gtk.Socket"></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.SizeGroup</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-gtksettings.html">Prev</a></td><th width="60%" align="center">The gtk Class Reference</th><td width="20%" align="right"><a accesskey="n" href="class-gtksocket.html">Next</a></td></tr></table><hr></div><div class="refentry" lang="en"><a name="class-gtksizegroup"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2>gtk.SizeGroup</h2><p>gtk.SizeGroup &#8212; an object that groups widgets so they request the same
size</p></div><div class="refsect1" lang="en"><a name="id3504187"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gtk.SizeGroup</span></span>(<span class="ooclass"><span class="classname"><a href="class-gobject.html" title="gobject.GObject">gobject.GObject</a></span></span>):
<code class="constructorsynopsis">    <span class="methodname"><a href="class-gtksizegroup.html#constructor-gtksizegroup" title="Constructor">gtk.SizeGroup</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>mode</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtksizegroup.html#method-gtksizegroup--set-mode" title="gtk.SizeGroup.set_mode">set_mode</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>mode</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtksizegroup.html#method-gtksizegroup--get-mode" title="gtk.SizeGroup.get_mode">get_mode</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtksizegroup.html#method-gtksizegroup--add-widget" title="gtk.SizeGroup.add_widget">add_widget</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>widget</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtksizegroup.html#method-gtksizegroup--remove-widget" title="gtk.SizeGroup.remove_widget">remove_widget</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>widget</tt></b></span></span>)</code><br></pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id3504312"></a><h2>Ancestry</h2><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="synopsis">+-- <a href="class-gobject.html" title="gobject.GObject">gobject.GObject</a>
  +-- <a href="class-gtksizegroup.html" title="gtk.SizeGroup">gtk.SizeGroup</a>
</pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id3504336"></a><h2>Properties</h2><div class="blockquote"><table width="100%" border="0" bgcolor="#E0E0E0"><tr><td valign="top"><div class="informaltable"><table width="100%" border="0"><colgroup><col><col><col></colgroup><tbody><tr valign="top"><td valign="top">"mode"</td><td valign="top">Read-Write</td><td valign="top">The directions in which the size group effects the
requested sizes of its component widgets - one of:
<tt class="literal">gtk.SIZE_GROUP_NONE</tt>,
<tt class="literal">gtk.SIZE_GROUP_HORIZONTAL</tt>,
<tt class="literal">gtk.SIZE_GROUP_VERTICAL</tt>,
<tt class="literal">gtk.SIZE_GROUP_BOTH</tt>.</td></tr></tbody></table></div></td></tr></table></div></div><div class="refsect1" lang="en"><a name="id3504422"></a><h2>Description</h2><p><a href="class-gtksizegroup.html" title="gtk.SizeGroup"><tt class="classname">gtk.SizeGroup</tt></a>
provides a mechanism for grouping a number of widgets together so they all
request the same amount of space. This is typically useful when you want a
column of widgets to have the same size, but you can't use a <a href="class-gtktable.html" title="gtk.Table"><tt class="classname">gtk.Table</tt></a> widget. The
size requested for each widget in a <a href="class-gtksizegroup.html" title="gtk.SizeGroup"><tt class="classname">gtk.SizeGroup</tt></a> is
the maximum of the sizes that would have been requested for each widget in
the size group if they were not in the size group. The mode of the size
group (see <a href="class-gtksizegroup.html#method-gtksizegroup--set-mode" title="gtk.SizeGroup.set_mode"><tt class="methodname">set_mode</tt>()</a>) 
determines whether this applies to the horizontal size, the vertical size,
or both sizes:</p><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><tt class="literal">gtk.SIZE_GROUP_NONE</tt></span></td><td>the group has no effect</td></tr><tr><td><span class="term"><tt class="literal">gtk.SIZE_GROUP_HORIZONTAL</tt></span></td><td>the group affects the horizontal requisition</td></tr><tr><td><span class="term"><tt class="literal">gtk.SIZE_GROUP_VERTICAL</tt></span></td><td>the group affects the vertical requisition</td></tr><tr><td><span class="term"><tt class="literal">gtk.SIZE_GROUP_BOTH</tt></span></td><td>the group affects both the  horizontal and vertical
requisition</td></tr></tbody></table><p>Note that size groups only affect the amount of space requested,
not the size that the widgets finally receive. If you want the widgets in a
<a href="class-gtksizegroup.html" title="gtk.SizeGroup"><tt class="classname">gtk.SizeGroup</tt></a> to
actually be the same size, you need to pack them in such a way that they get
the size they request and not more. For example, if you are packing your
widgets into a table, you would not include the <tt class="literal">gtk.FILL</tt>
flag. <a href="class-gtksizegroup.html" title="gtk.SizeGroup"><tt class="classname">gtk.SizeGroup</tt></a>
objects are referenced by each widget in the size group, so once you have
added all widgets to a <a href="class-gtksizegroup.html" title="gtk.SizeGroup"><tt class="classname">gtk.SizeGroup</tt></a>. If
the widgets in the size group are subsequently destroyed, then they will be
removed from the size group and drop their references on the size group;
when all widgets have been removed, the size group will be freed.</p><p>Widgets can be part of multiple size groups; PyGTK will compute
the horizontal size of a widget from the horizontal requisition of all
widgets that can be reached from the widget by a chain of size groups of
type <tt class="literal">gtk.SIZE_GROUP_HORIZONTAL</tt> or
<tt class="literal">gtk.SIZE_GROUP_BOTH</tt>, and the vertical size from the
vertical requisition of all widgets that can be reached from the widget by a
chain of size groups of type <tt class="literal">gtk.SIZE_GROUP_VERTICAL</tt> or
<tt class="literal">gtk.SIZE_GROUP_BOTH</tt>.</p></div><div class="refsect1" lang="en"><a name="constructor-gtksizegroup"></a><h2>Constructor</h2><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="constructorsynopsis">    <span class="methodname">gtk.SizeGroup</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>mode</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>mode</tt></b>:</span></td><td>the mode for the new size
group.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a new <a href="class-gtksizegroup.html" title="gtk.SizeGroup"><tt class="classname">gtk.SizeGroup</tt></a></td></tr></tbody></table><p>Creates a new <a href="class-gtksizegroup.html" title="gtk.SizeGroup"><tt class="classname">gtk.SizeGroup</tt></a>
with the mode specified by the value of <i class="parameter"><tt>mode</tt></i>:</p><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><tt class="literal">gtk.SIZE_GROUP_NONE</tt></span></td><td>the group has no effect</td></tr><tr><td><span class="term"><tt class="literal">gtk.SIZE_GROUP_HORIZONTAL</tt></span></td><td>the group affects the horizontal requisition</td></tr><tr><td><span class="term"><tt class="literal">gtk.SIZE_GROUP_VERTICAL</tt></span></td><td>the group affects the vertical requisition</td></tr><tr><td><span class="term"><tt class="literal">gtk.SIZE_GROUP_BOTH</tt></span></td><td>the group affects both the horizontal and vertical
requisition</td></tr></tbody></table><p></p></div><div class="refsect1" lang="en"><a name="id3504766"></a><h2>Methods</h2><div class="refsect2" lang="en"><a name="method-gtksizegroup--set-mode"></a><h3>gtk.SizeGroup.set_mode</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">set_mode</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>mode</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>mode</tt></b>:</span></td><td>the mode to set for the size
group.</td></tr></tbody></table><p>The <tt class="methodname">set_mode</tt>() method sets the "mode"
property of the size group to the value specified by
<i class="parameter"><tt>mode</tt></i>. The "mode" of the size group determines whether
the widgets in the size group should all have the same horizontal
requisition (<tt class="literal">gtk.SIZE_GROUP_MODE_HORIZONTAL</tt>) all have the
same vertical requisition (<tt class="literal">gtk.SIZE_GROUP_MODE_VERTICAL</tt>),
or should all have the same requisition in both directions
(<tt class="literal">gtk.SIZE_GROUP_MODE_BOTH</tt>).</p></div><div class="refsect2" lang="en"><a name="method-gtksizegroup--get-mode"></a><h3>gtk.SizeGroup.get_mode</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_mode</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>the current mode of the size
group.</td></tr></tbody></table><p>The <tt class="methodname">get_mode</tt>() method returns the value
of the "mode" property of the size group. See the <a href="class-gtksizegroup.html#method-gtksizegroup--set-mode" title="gtk.SizeGroup.set_mode"><tt class="methodname">set_mode</tt>()</a> 
method.</p></div><div class="refsect2" lang="en"><a name="method-gtksizegroup--add-widget"></a><h3>gtk.SizeGroup.add_widget</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">add_widget</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>widget</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>widget</tt></b>:</span></td><td>the <a href="class-gtkwidget.html" title="gtk.Widget"><tt class="classname">gtk.Widget</tt></a> to
add</td></tr></tbody></table><p>The <tt class="methodname">add_widget</tt>() method adds the widget
specified by <i class="parameter"><tt>widget</tt></i> to the <a href="class-gtksizegroup.html" title="gtk.SizeGroup"><tt class="classname">gtk.SizeGroup</tt></a>.
The requisition of the widget will then be determined as the maximum of its
requisition and the requisition of the other widgets in the size group.
Whether this applies horizontally, vertically, or in both directions depends
on the mode of the size group. See the <a href="class-gtksizegroup.html#method-gtksizegroup--set-mode" title="gtk.SizeGroup.set_mode"><tt class="methodname">set_mode</tt>()</a> 
method for more detail.</p></div><div class="refsect2" lang="en"><a name="method-gtksizegroup--remove-widget"></a><h3>gtk.SizeGroup.remove_widget</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">remove_widget</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>widget</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>widget</tt></b>:</span></td><td>the <a href="class-gtkwidget.html" title="gtk.Widget"><tt class="classname">gtk.Widget</tt></a> to
remove</td></tr></tbody></table><p>The remove_widget() method removes the widget specified by
widget from the <a href="class-gtksizegroup.html" title="gtk.SizeGroup"><tt class="classname">gtk.SizeGroup</tt></a>.</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-gtksettings.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-gtksocket.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">gtk.Settings</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">gtk.Socket</td></tr></table></div></body></html>