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=ISO-8859-1"><title>gtk.Alignment</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-gtkadjustment.html" title="gtk.Adjustment"><link rel="next" href="class-gtkarrow.html" title="gtk.Arrow"></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.Alignment</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-gtkadjustment.html">Prev</a></td><th width="60%" align="center">The gtk Class Reference</th><td width="20%" align="right"><a accesskey="n" href="class-gtkarrow.html">Next</a></td></tr></table><hr></div><div class="refentry" lang="en"><a name="class-gtkalignment"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2>gtk.Alignment</h2><p>gtk.Alignment — a widget that controls the alignment and size of its
child</p></div><div class="refsect1" lang="en"><a name="id2955502"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gtk.Alignment</span></span>(<span class="ooclass"><span class="classname"><a href="class-gtkbin.html" title="gtk.Bin">gtk.Bin</a></span></span>):
<code class="constructorsynopsis"> <span class="methodname"><a href="class-gtkalignment.html#constructor-gtkalignment" title="Constructor">gtk.Alignment</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>xalign</tt></b></span><span class="initializer">=0.0</span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>yalign</tt></b></span><span class="initializer">=0.0</span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>xscale</tt></b></span><span class="initializer">=0.0</span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>yscale</tt></b></span><span class="initializer">=0.0</span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gtkalignment.html#method-gtkalignment--set" title="gtk.Alignment.set">set</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>xalign</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>yalign</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>xscale</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>yscale</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gtkalignment.html#method-gtkalignment--set-padding" title="gtk.Alignment.set_padding">set_padding</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>padding_top</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>padding_bottom</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>padding_left</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>padding_right</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gtkalignment.html#method-gtkalignment--get-padding" title="gtk.Alignment.get_padding">get_padding</a></span>(<span class="methodparam"></span>)</code><br></pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id3094632"></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-gtkobject.html" title="gtk.Object">gtk.Object</a>
+-- <a href="class-gtkwidget.html" title="gtk.Widget">gtk.Widget</a>
+-- <a href="class-gtkcontainer.html" title="gtk.Container">gtk.Container</a>
+-- <a href="class-gtkbin.html" title="gtk.Bin">gtk.Bin</a>
+-- <a href="class-gtkalignment.html" title="gtk.Alignment">gtk.Alignment</a>
</pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id2972296"></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">"xalign"</td><td valign="top">Read/Write</td><td valign="top">The fraction of horizontal <span class="emphasis"><em>free</em></span> space to
the left of the child. 0.0 means no <span class="emphasis"><em>free</em></span> space to the
left, 1.0 means all <span class="emphasis"><em>free</em></span> space to the left.</td></tr><tr valign="top"><td valign="top">"yalign"</td><td valign="top">Read/Write</td><td valign="top">The fraction of vertical <span class="emphasis"><em>free</em></span> space
above the child. 0.0 means no <span class="emphasis"><em>free</em></span> space above, 1.0
means all <span class="emphasis"><em>free</em></span> space above.</td></tr><tr valign="top"><td valign="top">"xscale"</td><td valign="top">Read/Write</td><td valign="top">The fraction of horizontal <span class="emphasis"><em>free</em></span> space
(beyond that needed by the child) that the child will absorb. 0.0 means the
child will absorb none, 1.0 means the child will absorb all</td></tr><tr valign="top"><td valign="top">"yscale"</td><td valign="top">Read/Write</td><td valign="top">The fraction of vertical <span class="emphasis"><em>free</em></span> space
(beyond that needed by the child) that the child will absorb. 0.0 means the
child will absorb none, 1.0 means the child will absorb all</td></tr><tr valign="top"><td valign="top">"bottom-padding"</td><td valign="top">Read/Write</td><td valign="top">The padding to insert at the bottom of the widget. GTK+ 2.4
and above.</td></tr><tr valign="top"><td valign="top">"top-padding"</td><td valign="top">Read/Write</td><td valign="top">The padding to insert at the top of the widget. GTK+ 2.4
and above.</td></tr><tr valign="top"><td valign="top">"left-padding"</td><td valign="top">Read/Write</td><td valign="top">The padding to insert at the left of the widget. GTK+ 2.4
and above.</td></tr><tr valign="top"><td valign="top">"right-padding"</td><td valign="top">Read/Write</td><td valign="top">The padding to insert at the right of the widget. GTK+ 2.4
and above.</td></tr></tbody></table></div></td></tr></table></div></div><div class="refsect1" lang="en"><a name="id3004988"></a><h2>Description</h2><p>The <a href="class-gtkalignment.html" title="gtk.Alignment"><tt class="classname">gtk.Alignment</tt></a>
widget controls the alignment and size of its child widget. It has four
properties: xscale, yscale, xalign, and yalign. The scale properties are
used to specify how much of the <span class="emphasis"><em>free</em></span> (extra) space
allocated to the <a href="class-gtkalignment.html" title="gtk.Alignment"><tt class="classname">gtk.Alignment</tt></a>
should be absorbed by the child widget. The values can range from 0.0
(meaning the child absorbs none) to 1.0 (meaning the child absorbs all of
the <span class="emphasis"><em>free</em></span> space). If the value is 0.5, the child widget
absorbs half the <span class="emphasis"><em>free</em></span> space. The align properties are
used to place the child widget within the available area by specifying the
fraction of <span class="emphasis"><em>free</em></span> space that will be placed above or to
the left of the child widget. The values range from 0.0 (no
<span class="emphasis"><em>free</em></span> space above or to the left of the child) to 1.0
(all <span class="emphasis"><em>free</em></span> space above or to the left of the child). Of
course, if the scale properties are both set to 1.0, the alignment
properties have no effect.</p><p>An example may make this clearer. A <a href="class-gtkimage.html" title="gtk.Image"><tt class="classname">gtk.Button</tt></a> widget (32
pixels wide by 32 pixels high) is placed inside a <a href="class-gtkalignment.html" title="gtk.Alignment"><tt class="classname">gtk.Alignment</tt></a>
widget (256 pixels wide by 128 pixels high) which has xalign of 0.25, yalign
of 0.25, xscale of 0.25 and yscale of 0.25. The horizontal
<span class="emphasis"><em>free</em></span> space is 256-32=224 pixels and the vertical
<span class="emphasis"><em>free</em></span> space is 128-32=96 pixels. The button will absorb
0.25x224=56 pixels horizontally and 0.25x96=24 pixels vertically since the
xscale and yscale are 0.25 thus becoming 32+56=88 pixels wide by 32+24=56
pixels high. This will leave 256-88=168 pixels of horizontal
<span class="emphasis"><em>free</em></span> space and 128-56=72 pixels of vertical
<span class="emphasis"><em>free</em></span> space. Since the xalign value is 0.25 the
horizontal <span class="emphasis"><em>free</em></span> space will be allocated as 0.25x168=42
pixels to the left of the button and 0.72x168=126 pixels to the right.
Likewise since the yalign is 0.25 the vertical <span class="emphasis"><em>free</em></span>
space is allocated as 0.25x72=18 pixels above the button and 0.75*72=54
pixels below.</p></div><div class="refsect1" lang="en"><a name="constructor-gtkalignment"></a><h2>Constructor</h2><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="constructorsynopsis"> <span class="methodname">gtk.Alignment</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>xalign</tt></b></span><span class="initializer">=0.0</span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>yalign</tt></b></span><span class="initializer">=0.0</span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>xscale</tt></b></span><span class="initializer">=0.0</span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>yscale</tt></b></span><span class="initializer">=0.0</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>xalign</tt></b>:</span></td><td>the fraction of horizontal
<span class="emphasis"><em>free</em></span> space to the left of the child widget. Ranges from
0.0 to 1.0</td></tr><tr><td><span class="term"><b class="parameter"><tt>yalign</tt></b>:</span></td><td>the fraction of vertical
<span class="emphasis"><em>free</em></span> space above the child widget. Ranges from 0.0 to
1.0</td></tr><tr><td><span class="term"><b class="parameter"><tt>xscale</tt></b>:</span></td><td>the fraction of horizontal
<span class="emphasis"><em>free</em></span> space that the child widget absorbs, from 0.0 to
1.0</td></tr><tr><td><span class="term"><b class="parameter"><tt>yscale</tt></b>:</span></td><td>the fraction of vertical
<span class="emphasis"><em>free</em></span> space that the child widget absorbs, from 0.0 to
1.0</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a new alignment object</td></tr></tbody></table><p>Creates a new alignment widget with the specified properties. If
the scale and alignment parameters are not specified they default to
0.0.</p></div><div class="refsect1" lang="en"><a name="id3137887"></a><h2>Methods</h2><div class="refsect2" lang="en"><a name="method-gtkalignment--set"></a><h3>gtk.Alignment.set</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>xalign</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>yalign</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>xscale</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>yscale</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>xalign</tt></b>:</span></td><td>the fraction of horizontal
<span class="emphasis"><em>free</em></span> space to the left of the child widget. Ranges from
0.0 to 1.0</td></tr><tr><td><span class="term"><b class="parameter"><tt>yalign</tt></b>:</span></td><td>the fraction of vertical
<span class="emphasis"><em>free</em></span> space above the child widget. Ranges from 0.0 to
1.0</td></tr><tr><td><span class="term"><b class="parameter"><tt>xscale</tt></b>:</span></td><td>the fraction of horizontal
<span class="emphasis"><em>free</em></span> space that the child widget absorbs, from 0.0 to
1.0</td></tr><tr><td><span class="term"><b class="parameter"><tt>yscale</tt></b>:</span></td><td>the fraction of vertical
<span class="emphasis"><em>free</em></span> space that the child widget absorbs, from 0.0 to
1.0</td></tr></tbody></table><p>The <tt class="methodname">set</tt>() method sets the properties of
the alignment widget to the specified values.</p></div><div class="refsect2" lang="en"><a name="method-gtkalignment--set-padding"></a><h3>gtk.Alignment.set_padding</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_padding</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>padding_top</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>padding_bottom</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>padding_left</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>padding_right</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>padding_top</tt></b>:</span></td><td> the padding at the top of the
widget</td></tr><tr><td><span class="term"><b class="parameter"><tt>padding_bottom</tt></b>:</span></td><td> the padding at the bottom of the
widget</td></tr><tr><td><span class="term"><b class="parameter"><tt>padding_left</tt></b>:</span></td><td> the padding at the left of the
widget</td></tr><tr><td><span class="term"><b class="parameter"><tt>padding_right</tt></b>:</span></td><td> the padding at the right of the
widget.</td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.4 and above.</p></div><p>The <tt class="methodname">set_padding</tt>() method sets the
padding around the sides of the alignment widget to the values specified by
<i class="parameter"><tt>padding_top</tt></i>, <i class="parameter"><tt>padding_bottom</tt></i>,
<i class="parameter"><tt>padding_left</tt></i> and
<i class="parameter"><tt>padding_right</tt></i>. The padding adds blank space to the
sides of the widget. For instance, this can be used to indent the child
widget toward the right by adding padding on the left.</p></div><div class="refsect2" lang="en"><a name="method-gtkalignment--get-padding"></a><h3>gtk.Alignment.get_padding</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_padding</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a 4-tuple containing the padding set on the
top, bottom, left and right sides of the
widget</td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.4 and above.</p></div><p>The <tt class="methodname">get_padding</tt>() method returns a
4-tuple containing the padding set on the sides of the widget.</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-gtkadjustment.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-gtkarrow.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">gtk.Adjustment</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">gtk.Arrow</td></tr></table></div></body></html>
|