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
|
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>gtk.AspectFrame</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-gtkarrow.html" title="gtk.Arrow"><link rel="next" href="class-gtkbin.html" title="gtk.Bin"></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.AspectFrame</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-gtkarrow.html">Prev</a></td><th width="60%" align="center">The gtk Class Reference</th><td width="20%" align="right"><a accesskey="n" href="class-gtkbin.html">Next</a></td></tr></table><hr></div><div class="refentry" lang="en"><a name="class-gtkaspectframe"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2>gtk.AspectFrame</h2><p>gtk.AspectFrame — A frame that constrains its child to a particular aspect
ratio.</p></div><div class="refsect1" lang="en"><a name="id3138000"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gtk.AspectFrame</span></span>(<span class="ooclass"><span class="classname"><a href="class-gtkframe.html" title="gtk.Frame">gtk.Frame</a></span></span>):
<code class="constructorsynopsis"> <span class="methodname"><a href="class-gtkaspectframe.html#constructor-gtkaspectframe" title="Constructor">gtk.AspectFrame</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>label</tt></b></span><span class="initializer">=None</span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>xalign</tt></b></span><span class="initializer">=0.5</span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>yalign</tt></b></span><span class="initializer">=0.5</span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>ratio</tt></b></span><span class="initializer">=1.0</span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>obey_child</tt></b></span><span class="initializer">=TRUE</span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gtkaspectframe.html#method-gtkaspectframe--set" title="gtk.AspectFrame.set">set</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>ratio</tt></b></span><span class="initializer">=1.0</span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>obey_child</tt></b></span><span class="initializer">=TRUE</span></span>)</code><br></pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id3156485"></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-gtkframe.html" title="gtk.Frame">gtk.Frame</a>
+-- <a href="class-gtkaspectframe.html" title="gtk.AspectFrame">gtk.AspectFrame</a>
</pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id3261900"></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">"ratio"</td><td valign="top">Read/Write</td><td valign="top">The aspect ratio of the widget in the range of 0.0001 to
10000.0 if "obey-child" is FALSE.</td></tr><tr valign="top"><td valign="top">"obey-child"</td><td valign="top">Read/Write</td><td valign="top">Make aspect ratio match that of the child widget</td></tr></tbody></table></div></td></tr></table></div></div><div class="refsect1" lang="en"><a name="id2989023"></a><h2>Description</h2><p>The <a href="class-gtkaspectframe.html" title="gtk.AspectFrame"><tt class="classname">gtk.AspectFrame</tt></a>
packs a widget so that it can resize but always retains the same aspect
ratio. For instance, one might be drawing a small preview of a larger image.
<a href="class-gtkaspectframe.html" title="gtk.AspectFrame"><tt class="classname">gtk.AspectFrame</tt></a>
derives from <a href="class-gtkframe.html" title="gtk.Frame"><tt class="classname">gtk.Frame</tt></a>, so it can
draw a label and a frame around the child. The frame will be
"shrink-wrapped" to the size of the child.</p><p>The aspect frame "ratio" property determines the widget
width:height ratio. An aspect ratio of 0.5 means the width is one half the
height; an aspect ratio of 2.0 means the width is twice the height. The
default value for the "ratio" property is 1.0.</p><p>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
(space in the aspect frame that is not used by the child widget) that is
placed above or to the left of the child widget. The values range from 0.0
(meaning no <span class="emphasis"><em>free</em></span> space above or to the left of the
child) to 1.0 (meaning all <span class="emphasis"><em>free</em></span> space above or to the
left of the child) . The default value for both align properties is
0.5.</p><p>If the "obey-child" property is TRUE (the default value), the
"ratio" property is ignored and the aspect ratio is set by the child
widget.</p></div><div class="refsect1" lang="en"><a name="constructor-gtkaspectframe"></a><h2>Constructor</h2><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="constructorsynopsis"> <span class="methodname">gtk.AspectFrame</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>label</tt></b></span><span class="initializer">=None</span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>xalign</tt></b></span><span class="initializer">=0.5</span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>yalign</tt></b></span><span class="initializer">=0.5</span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>ratio</tt></b></span><span class="initializer">=1.0</span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>obey_child</tt></b></span><span class="initializer">=TRUE</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>label</tt></b>:</span></td><td>a string used to set the aspect frame
label</td></tr><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. 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><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. 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><td><span class="term"><b class="parameter"><tt>ratio</tt></b>:</span></td><td>the ratio of the child width to height (in the
range 0.0001 to 10000.0) if <i class="parameter"><tt>obey_child</tt></i> is
FALSE</td></tr><tr><td><span class="term"><b class="parameter"><tt>obey_child</tt></b>:</span></td><td>if TRUE, <i class="parameter"><tt>ratio</tt></i> is ignored,
and the aspect ratio is taken from the requisition of the
child.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a new aspect frame object</td></tr></tbody></table><p>Creates a new aspect frame object with the specified
<i class="parameter"><tt>label</tt></i>, <i class="parameter"><tt>xalign</tt></i> and
<i class="parameter"><tt>yalign</tt></i> values. The default values are:
<i class="parameter"><tt>label</tt></i>, None; <i class="parameter"><tt>xalign</tt></i>, 0.5; and,
<i class="parameter"><tt>yalign</tt></i>, 0.5. If <i class="parameter"><tt>obey_child</tt></i> is
TRUE the <i class="parameter"><tt>ratio</tt></i> value is ignored. If
<i class="parameter"><tt>obey_child</tt></i> is FALSE, <i class="parameter"><tt>ratio</tt></i>
sets the aspect ratio for the child widget. The default value for
<i class="parameter"><tt>ratio</tt></i> is 1.0. The default value for
<i class="parameter"><tt>obey_child</tt></i> is TRUE.</p></div><div class="refsect1" lang="en"><a name="id3156364"></a><h2>Methods</h2><div class="refsect2" lang="en"><a name="method-gtkaspectframe--set"></a><h3>gtk.AspectFrame.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 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>ratio</tt></b></span><span class="initializer">=1.0</span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>obey_child</tt></b></span><span class="initializer">=TRUE</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. 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><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. 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><td><span class="term"><b class="parameter"><tt>ratio</tt></b>:</span></td><td>the ratio of the child width to height (in the
range 0.0001 to 10000.0) if <i class="parameter"><tt>obey_child</tt></i> is
FALSE</td></tr><tr><td><span class="term"><b class="parameter"><tt>obey_child</tt></b>:</span></td><td>if TRUE, <i class="parameter"><tt>ratio</tt></i> is
ignored, and the aspect ratio is taken from the requisition of the
child</td></tr></tbody></table><p>The <tt class="methodname">set</tt>() method changes the aspect
frame properties to the values specified by <i class="parameter"><tt>xalign</tt></i>,
<i class="parameter"><tt>yalign</tt></i>, <i class="parameter"><tt>ratio</tt></i> and
<i class="parameter"><tt>obey_child</tt></i>. The default values are:
<i class="parameter"><tt>xalign</tt></i>, 0; <i class="parameter"><tt>yalign</tt></i>, 0.0;
<i class="parameter"><tt>ratio</tt></i>, 1.0; and, <i class="parameter"><tt>obey_child</tt></i>,
TRUE.</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-gtkarrow.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-gtkbin.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">gtk.Arrow</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">gtk.Bin</td></tr></table></div></body></html>
|