File: class-gtkscale.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 (64 lines) | stat: -rw-r--r-- 18,747 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
62
63
64
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>gtk.Scale</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-gtkruler.html" title="gtk.Ruler"><link rel="next" href="class-gtkscrollbar.html" title="gtk.Scrollbar"></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.Scale</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-gtkruler.html">Prev</a></td><th width="60%" align="center">The gtk Class Reference</th><td width="20%" align="right"><a accesskey="n" href="class-gtkscrollbar.html">Next</a></td></tr></table><hr></div><div class="refentry" lang="en"><a name="class-gtkscale"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2>gtk.Scale</h2><p>gtk.Scale &#8212; a base class for the scale widgets.</p></div><div class="refsect1" lang="en"><a name="id3494380"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gtk.Scale</span></span>(<span class="ooclass"><span class="classname"><a href="class-gtkrange.html" title="gtk.Range">gtk.Range</a></span></span>):
<code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkscale.html#method-gtkscale--set-digits" title="gtk.Scale.set_digits">set_digits</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>digits</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkscale.html#method-gtkscale--get-digits" title="gtk.Scale.get_digits">get_digits</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkscale.html#method-gtkscale--set-draw-value" title="gtk.Scale.set_draw_value">set_draw_value</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>draw_value</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkscale.html#method-gtkscale--get-draw-value" title="gtk.Scale.get_draw_value">get_draw_value</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkscale.html#method-gtkscale--set-value-pos" title="gtk.Scale.set_value_pos">set_value_pos</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>pos</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkscale.html#method-gtkscale--get-value-pos" title="gtk.Scale.get_value_pos">get_value_pos</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkscale.html#method-gtkscale--get-layout" title="gtk.Scale.get_layout">get_layout</a></span>()</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkscale.html#method-gtkscale--get-layout-offsets" title="gtk.Scale.get_layout_offsets">get_layout_offsets</a></span>(<span class="methodparam"></span>)</code><br></pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id3494545"></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-gtkrange.html" title="gtk.Range">gtk.Range</a>
        +-- <a href="class-gtkscale.html" title="gtk.Scale">gtk.Scale</a>
</pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id3494587"></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">"digits"</td><td valign="top">Read-Write</td><td valign="top">The number of decimal places that are displayed in the
value</td></tr><tr valign="top"><td valign="top">"draw-value"</td><td valign="top">Read-Write</td><td valign="top">If <tt class="literal">TRUE</tt> the current value is
displayed as a string next to the slider</td></tr><tr valign="top"><td valign="top">"value-pos"</td><td valign="top">Read-Write</td><td valign="top">The position in which the current value is displayed:
<tt class="literal">gtk.POS_LEFT</tt>, <tt class="literal">gtk.POS_RIGHT</tt>,
<tt class="literal">gtk.POS_TOP</tt> or <tt class="literal">gtk.POS_BOTTOM</tt></td></tr></tbody></table></div></td></tr></table></div></div><div class="refsect1" lang="en"><a name="id3494712"></a><h2>Style 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">"slider-length"</td><td valign="top">Read</td><td valign="top">The length of scale's slider</td></tr><tr valign="top"><td valign="top">"value-spacing"</td><td valign="top">Read</td><td valign="top">The space between value text and the slider or trough
area</td></tr></tbody></table></div></td></tr></table></div></div><div class="refsect1" lang="en"><a name="id3494800"></a><h2>Signal Prototypes</h2><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term">"<a href="class-gtkscale.html#signal-gtkscale--format-value" title='The "format-value" gtk.Scale Signal'>format-value</a>"</span></td><td><code class="methodsynopsis">    def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><i class="parameter"><tt>scale</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>user_param1</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>...</tt></i></span></span>)</code></td></tr></tbody></table></div><div class="refsect1" lang="en"><a name="id3494852"></a><h2>Description</h2><p>The <a href="class-gtkscale.html" title="gtk.Scale"><tt class="classname">gtk.Scale</tt></a> widget is
an abstract base class, used only for deriving the subclasses <a href="class-gtkhscale.html" title="gtk.HScale"><tt class="classname">gtk.HScale</tt></a> and <a href="class-gtkvscale.html" title="gtk.VScale"><tt class="classname">gtk.VScale</tt></a>. A <a href="class-gtkscale.html" title="gtk.Scale"><tt class="classname">gtk.Scale</tt></a> is a slider
control used to select a numeric value. Since <a href="class-gtkscale.html" title="gtk.Scale"><tt class="classname">gtk.Scale</tt></a> is a
subclass of <a href="class-gtkrange.html" title="gtk.Range"><tt class="classname">gtk.Range</tt></a>, see the
<a href="class-gtkrange.html" title="gtk.Range"><tt class="classname">gtk.Range</tt></a>
methods for additional methods. To set the value of a scale, you would
normally use <a href="class-gtkrange.html#method-gtkrange--set-value" title="gtk.Range.set_value"><tt class="methodname">set_value</tt>()</a>. 
To detect changes to the value, you would normally use the "value_changed"
signal.</p></div><div class="refsect1" lang="en"><a name="id3494927"></a><h2>Methods</h2><div class="refsect2" lang="en"><a name="method-gtkscale--set-digits"></a><h3>gtk.Scale.set_digits</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">set_digits</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>digits</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>digits</tt></b>:</span></td><td>the number of decimal places to
display</td></tr></tbody></table><p>The <tt class="methodname">set_digits</tt>() method sets the
"digits" property to the value specified by <i class="parameter"><tt>digits</tt></i>.
The value of <i class="parameter"><tt>digits</tt></i> specifies the number of decimal
places that are displayed in the value. The value of the adjustment is also
rounded off to this number of digits, so the retrieved value matches the
value the user sees.</p></div><div class="refsect2" lang="en"><a name="method-gtkscale--get-digits"></a><h3>gtk.Scale.get_digits</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_digits</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 number of decimal places that are
displayed.</td></tr></tbody></table><p>The <tt class="methodname">get_digits</tt>() method returns the
value of the "digits" property that indicates the number of decimal places
that are displayed in the value.</p></div><div class="refsect2" lang="en"><a name="method-gtkscale--set-draw-value"></a><h3>gtk.Scale.set_draw_value</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">set_draw_value</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>draw_value</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>draw_value</tt></b>:</span></td><td>If <tt class="literal">TRUE</tt> draw the current
value next to the slider</td></tr></tbody></table><p>The <tt class="methodname">set_draw_value</tt>() method sets the
"draw-value" property to the value specified by
<i class="parameter"><tt>draw_value</tt></i>. If <i class="parameter"><tt>draw_value</tt></i> is
<i class="parameter"><tt>TRUE</tt></i> the current value is displayed next to the
slider.</p></div><div class="refsect2" lang="en"><a name="method-gtkscale--get-draw-value"></a><h3>gtk.Scale.get_draw_value</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_draw_value</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><tt class="literal">TRUE</tt> if the current value is
to be drawn next to the slider</td></tr></tbody></table><p>The <tt class="methodname">get_draw_value</tt>() method returns the
value of the "draw-value" property. If "draw-value" is
<tt class="literal">TRUE</tt> the current scale value is drawn next to the
slider.</p></div><div class="refsect2" lang="en"><a name="method-gtkscale--set-value-pos"></a><h3>gtk.Scale.set_value_pos</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">set_value_pos</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>pos</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>pos</tt></b>:</span></td><td>the position where the current value is
displayed.</td></tr></tbody></table><p>The <tt class="methodname">set_value_pos</tt>() method sets the
value of the "value-pos" property to the value specified by
<i class="parameter"><tt>pos</tt></i>. The value of <i class="parameter"><tt>pos</tt></i> must be
one of: <tt class="literal">gtk.POS_LEFT</tt>, <tt class="literal">gtk.POS_RIGHT</tt>,
<tt class="literal">gtk.POS_TOP</tt> or <tt class="literal">gtk.POS_BOTTOM</tt>.</p></div><div class="refsect2" lang="en"><a name="method-gtkscale--get-value-pos"></a><h3>gtk.Scale.get_value_pos</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_value_pos</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 position where the current value is
displayed.</td></tr></tbody></table><p>The <tt class="methodname">get_value_pos</tt>() method returns the
value of the "value-pos" property. See the <a href="class-gtkscale.html#method-gtkscale--set-value-pos" title="gtk.Scale.set_value_pos"><tt class="methodname">set_value_pos</tt>()</a> 
method.</p></div><div class="refsect2" lang="en"><a name="method-gtkscale--get-layout"></a><h3>gtk.Scale.get_layout</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_layout</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 <a href="class-pangolayout.html" title="pango.Layout"><tt class="classname">pango.Layout</tt></a>
	  for this scale or <tt class="literal">None</tt> if the draw_value
	  property is <tt class="literal">FALSE</tt>.</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_layout</tt>() method returns the
<a href="class-pangolayout.html" title="pango.Layout"><tt class="classname">pango.Layout</tt></a>
used to display the scale.</p></div><div class="refsect2" lang="en"><a name="method-gtkscale--get-layout-offsets"></a><h3>gtk.Scale.get_layout_offsets</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_layout_offsets</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 2-tuple containing the coordinates where the
	  scale will draw the <a href="class-pangolayout.html" title="pango.Layout"><tt class="classname">pango.Layout</tt></a>
	  representing the text in the scale</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_layout_offsets</tt>() method returns
a 2-tuple containing the coordinates where the scale will draw the <a href="class-pangolayout.html" title="pango.Layout"><tt class="classname">pango.Layout</tt></a>
representing the text in the scale. Remember when using the <a href="class-pangolayout.html" title="pango.Layout"><tt class="classname">pango.Layout</tt></a>
function you need to convert to and from pixels using the <a href="class-pangofont.html#function-pango--PIXELS" title="pango.PIXELS"><tt class="function">pango.PIXELS</tt>()</a>
function or <tt class="literal">pango.SCALE</tt>. If the "draw-value" property is
<tt class="literal">FALSE</tt>, the return values are undefined.</p></div></div><div class="refsect1" lang="en"><a name="id3495525"></a><h2>Signals</h2><div class="refsect2" lang="en"><a name="signal-gtkscale--format-value"></a><h3>The "format-value" gtk.Scale Signal</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><i class="parameter"><tt>scale</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>value</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>user_param1</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>...</tt></i></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"><i class="parameter"><tt>scale</tt></i>:</span></td><td>the scale that received the
signal</td></tr><tr><td><span class="term"><i class="parameter"><tt>value</tt></i>:</span></td><td>the value to be formatted</td></tr><tr><td><span class="term"><i class="parameter"><tt>user_param1</tt></i>:</span></td><td>the first user parameter (if any) specified
with the <a href="class-gobject.html#method-gobject--connect" title="gobject.GObject.connect"><tt class="methodname">connect</tt>()</a>
method</td></tr><tr><td><span class="term"><i class="parameter"><tt>...</tt></i>:</span></td><td>additional user parameters (if
any)</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a string representing
	  <i class="parameter"><tt>value</tt></i> for display</td></tr></tbody></table><p>The "format-value" signal is emitted when the scale is being
redrawn with a value displayed. The "format-value" signal handler should
return a formatted string containing <i class="parameter"><tt>value</tt></i>.</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-gtkruler.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-gtkscrollbar.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">gtk.Ruler</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">gtk.Scrollbar</td></tr></table></div></body></html>