source: pkg/pygtk/branches/upstream/current/docs/html/class-gdkpixbufanimationiter.html @ 4

Revision 4, 13.6 KB checked in by alanbach-guest, 6 years ago (diff)

[svn-inject] Installing original source of pygtk

Line 
1<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>gtk.gdk.PixbufAnimationIter</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.68.1"><link rel="start" href="index.html" title="PyGTK 2.0 Reference Manual"><link rel="up" href="gdk-class-reference.html" title="The gtk.gdk Class Reference"><link rel="prev" href="class-gdkpixbufanimation.html" title="gtk.gdk.PixbufAnimation"><link rel="next" href="class-gdkpixbufloader.html" title="gtk.gdk.PixbufLoader"></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.gdk.PixbufAnimationIter</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-gdkpixbufanimation.html">Prev</a> </td><th width="60%" align="center">The gtk.gdk Class Reference</th><td width="20%" align="right"> <a accesskey="n" href="class-gdkpixbufloader.html">Next</a></td></tr></table><hr></div><div class="refentry" lang="en"><a name="class-gdkpixbufanimationiter"></a><div class="titlepage"></div><div class="refnamediv"><h2>gtk.gdk.PixbufAnimationIter</h2><p>gtk.gdk.PixbufAnimationIter — an object providing access to the frames of a <a href="class-gdkpixbufanimation.html" title="gtk.gdk.PixbufAnimation"><code class="classname">gtk.gdk.PixbufAnimation</code></a></p></div><div class="refsect1" lang="en"><a name="id3028108"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gtk.gdk.PixbufAnimationIter</span></span>(<span class="ooclass"><span class="classname"><PYGTKDOCLINK HREF="class-gobject">gobject.GObject</PYGTKDOCLINK></span></span>):
2<code class="methodsynopsis">    def <span class="methodname"><a href="class-gdkpixbufanimationiter.html#method-gdkpixbufanimationiter--get-delay-time" title="gtk.gdk.PixbufAnimationIter.get_delay_time">get_delay_time</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gdkpixbufanimationiter.html#method-gdkpixbufanimationiter--get-pixbuf" title="gtk.gdk.PixbufAnimationIter.get_pixbuf">get_pixbuf</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gdkpixbufanimationiter.html#method-gdkpixbufanimationiter--on-currently-loading-frame" title="gtk.gdk.PixbufAnimationIter.on_currently_loading_frame">on_currently_loading_frame</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gdkpixbufanimationiter.html#method-gdkpixbufanimationiter--advance" title="gtk.gdk.PixbufAnimationIter.advance">advance</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>current_time</code></strong></span><span class="initializer">=0.0</span></span>)</code><br></pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id3028228"></a><h2>Ancestry</h2><pre class="synopsis">+-- <PYGTKDOCLINK HREF="class-gobject">gobject.GObject</PYGTKDOCLINK>
3  +-- <a href="class-gdkpixbufanimationiter.html" title="gtk.gdk.PixbufAnimationIter">gtk.gdk.PixbufAnimationIter</a>
4</pre></div><div class="refsect1" lang="en"><a name="id3101096"></a><h2>Description</h2><p>A <a href="class-gdkpixbufanimationiter.html" title="gtk.gdk.PixbufAnimationIter"><code class="classname">gtk.gdk.PixbufAnimationIter</code></a>
5is used to access the frames of a <a href="class-gdkpixbufanimation.html" title="gtk.gdk.PixbufAnimation"><code class="classname">gtk.gdk.PixbufAnimation</code></a>
6at specified times. A <a href="class-gdkpixbufanimationiter.html" title="gtk.gdk.PixbufAnimationIter"><code class="classname">gtk.gdk.PixbufAnimationIter</code></a>
7object is created using the <a href="class-gdkpixbufanimation.html#method-gdkpixbufanimation--get-iter" title="gtk.gdk.PixbufAnimation.get_iter"><code class="methodname">gtk.gdk.PixbufAnimation.get_iter</code>()</a>
8method. After creating an iterator, you should immediately display the
9pixbuf returned by the <a href="class-gdkpixbufanimationiter.html#method-gdkpixbufanimationiter--get-pixbuf" title="gtk.gdk.PixbufAnimationIter.get_pixbuf"><code class="methodname">get_pixbuf</code>()</a>
10method. Then, you should install a timeout (with the <PYGTKDOCLINK HREF="function-gobject--timeout-add"><code class="methodname">gobject.timeout_add</code>()</PYGTKDOCLINK>()
11function) or by some other mechanism ensure that you'll update the image
12after the number of milliseconds specified by the <a href="class-gdkpixbufanimationiter.html#method-gdkpixbufanimationiter--get-delay-time" title="gtk.gdk.PixbufAnimationIter.get_delay_time"><code class="methodname">get_delay_time</code>()</a>
13method. Each time the image is updated, you should reinstall the timeout
14with the new, possibly-changed delay time.</p><p>To update the image (i.e. possibly change the result of the <a href="class-gdkpixbufanimationiter.html#method-gdkpixbufanimationiter--get-pixbuf" title="gtk.gdk.PixbufAnimationIter.get_pixbuf"><code class="methodname">get_pixbuf</code>()</a> 
15method to a new frame of the animation), call the <a href="class-gdkpixbufanimationiter.html#method-gdkpixbufanimationiter--advance" title="gtk.gdk.PixbufAnimationIter.advance"><code class="methodname">advance</code>()</a> 
16method.</p><p>If you're using a <a href="class-gdkpixbufloader.html" title="gtk.gdk.PixbufLoader"><code class="classname">gtk.gdk.PixbufLoader</code></a>,
17in addition to updating the image after the delay time, you should also
18update it whenever you receive the "area_updated" signal and the <a href="class-gdkpixbufanimationiter.html#method-gdkpixbufanimationiter--on-currently-loading-frame" title="gtk.gdk.PixbufAnimationIter.on_currently_loading_frame"><code class="methodname">on_currently_loading_frame</code>()</a> 
19method returns <code class="literal">True</code>. In this case, the frame currently
20being fed into the loader has received new data, so needs to be refreshed.
21The delay time for a frame may also be modified after an "area_updated"
22signal, for example if the delay time for a frame is encoded in the data
23after the frame itself. So your timeout should be reinstalled after any
24area_updated signal. A delay time of -1 is possible, indicating
25"infinite."</p></div><div class="refsect1" lang="en"><a name="id3101221"></a><h2>Methods</h2><div class="refsect2" lang="en"><a name="method-gdkpixbufanimationiter--get-delay-time"></a><h3>gtk.gdk.PixbufAnimationIter.get_delay_time</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_delay_time</span>(<span class="methodparam"></span>)</code></pre><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 delay time in milliseconds (thousandths of
26a second)</td></tr></tbody></table><p>The <code class="methodname">get_delay_time</code>() method returns the
27number of milliseconds the current pixbuf should be displayed, or -1 if the
28current pixbuf should be displayed forever. The <PYGTKDOCLINK HREF="function-gobject--timeout-add"><code class="methodname">gobject.timeout_add</code>()</PYGTKDOCLINK>()
29function conveniently takes a timeout in milliseconds, so you can use a
30timeout to schedule the next update.</p></div><div class="refsect2" lang="en"><a name="method-gdkpixbufanimationiter--get-pixbuf"></a><h3>gtk.gdk.PixbufAnimationIter.get_pixbuf</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_pixbuf</span>(<span class="methodparam"></span>)</code></pre><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 <a href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a> to be
31displayed</td></tr></tbody></table><p>The <code class="methodname">get_pixbuf</code>() method returns the
32current <a href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a> that
33should be displayed. The pixbuf will be the same size as the animation
34itself (see the <a href="class-gdkpixbufanimation.html#method-gdkpixbufanimation--get-width" title="gtk.gdk.PixbufAnimation.get_width"><code class="methodname">gtk.gdk.PixbufAnimation.get_width</code>()</a> 
35and <a href="class-gdkpixbufanimation.html#method-gdkpixbufanimation--get-height" title="gtk.gdk.PixbufAnimation.get_height"><code class="methodname">gtk.gdk.PixbufAnimation.get_height</code>()</a> 
36methods). The <a href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a>
37should be displayed for the number of milliseconds specified by the <a href="class-gdkpixbufanimationiter.html#method-gdkpixbufanimationiter--get-delay-time" title="gtk.gdk.PixbufAnimationIter.get_delay_time"><code class="methodname">get_delay_time</code>()</a> 
38method.</p></div><div class="refsect2" lang="en"><a name="method-gdkpixbufanimationiter--on-currently-loading-frame"></a><h3>gtk.gdk.PixbufAnimationIter.on_currently_loading_frame</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">on_currently_loading_frame</span>(<span class="methodparam"></span>)</code></pre><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><code class="literal">True</code> if the frame we're on
39is partially loaded, or the last frame</td></tr></tbody></table><p>The <code class="methodname">on_currently_loading_frame</code>() method
40returns <code class="literal">True</code> if the frame currently pointed to by the
41iterator is partially loaded or the last frame. This method is used to
42determine how to respond to the "area_updated" signal on <a href="class-gdkpixbufloader.html" title="gtk.gdk.PixbufLoader"><code class="classname">gtk.gdk.PixbufLoader</code></a> 
43when loading an animation. The "area_updated" signal is emitted for an area
44of the frame currently streaming in to the loader. So if you're on the
45currently loading frame, you need to redraw the screen for the updated
46area.</p></div><div class="refsect2" lang="en"><a name="method-gdkpixbufanimationiter--advance"></a><h3>gtk.gdk.PixbufAnimationIter.advance</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">advance</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>current_time</code></strong></span><span class="initializer">=0.0</span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><strong class="parameter"><code>current_time</code></strong> :</span></td><td>the current time as a float or 0.0 to
47automatically determine the current time</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td><code class="literal">True</code> if the image may need
48updating</td></tr></tbody></table><p>The <code class="methodname">advance</code>() method attempts to
49advance an animation to a new frame. The frame is chosen based on the start
50time passed to the <a href="class-gdkpixbufanimation.html#method-gdkpixbufanimation--get-iter" title="gtk.gdk.PixbufAnimation.get_iter"><code class="methodname">gtk.gdk.PixbufAnimation.get_iter</code>()</a> 
51method. <em class="parameter"><code>current_time</code></em> is normally the current time (as
52specified by the Python time.time() function) and must be greater than or
53equal to the time passed to the <a href="class-gdkpixbufanimation.html#method-gdkpixbufanimation--get-iter" title="gtk.gdk.PixbufAnimation.get_iter"><code class="methodname">gtk.gdk.PixbufAnimation.get_iter</code>()</a> 
54method, and must increase or remain unchanged each time the <a href="class-gdkpixbufanimationiter.html#method-gdkpixbufanimationiter--get-pixbuf" title="gtk.gdk.PixbufAnimationIter.get_pixbuf"><code class="methodname">get_pixbuf</code>()</a> 
55method is called. That is, you can't go backward in time; animations only
56play forward. As a shortcut, pass 0.0 (the default) for the current time and
57the current time will automatically be determined an used. So you only need
58to explicitly pass <em class="parameter"><code>current_time</code></em> if you're doing
59something odd like playing the animation at double speed.</p><p>If this method returns <code class="literal">False</code>, there's no need
60to update the animation display, assuming the display had been rendered
61prior to advancing; if <code class="literal">True</code>, you need to call the <a href="class-gdkpixbufanimationiter.html#method-gdkpixbufanimationiter--get-pixbuf" title="gtk.gdk.PixbufAnimationIter.get_pixbuf"><code class="methodname">get_pixbuf</code>()</a> 
62method and update the display with the new pixbuf.</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-gdkpixbufanimation.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="gdk-class-reference.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="class-gdkpixbufloader.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">gtk.gdk.PixbufAnimation </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> gtk.gdk.PixbufLoader</td></tr></table></div></body></html>
Note: See TracBrowser for help on using the repository browser.