| 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> |
|---|
| 5 | is used to access the frames of a <a href="class-gdkpixbufanimation.html" title="gtk.gdk.PixbufAnimation"><code class="classname">gtk.gdk.PixbufAnimation</code></a> |
|---|
| 6 | at specified times. A <a href="class-gdkpixbufanimationiter.html" title="gtk.gdk.PixbufAnimationIter"><code class="classname">gtk.gdk.PixbufAnimationIter</code></a> |
|---|
| 7 | object 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> |
|---|
| 8 | method. After creating an iterator, you should immediately display the |
|---|
| 9 | pixbuf 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> |
|---|
| 10 | method. Then, you should install a timeout (with the <PYGTKDOCLINK HREF="function-gobject--timeout-add"><code class="methodname">gobject.timeout_add</code>()</PYGTKDOCLINK>() |
|---|
| 11 | function) or by some other mechanism ensure that you'll update the image |
|---|
| 12 | after 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> |
|---|
| 13 | method. Each time the image is updated, you should reinstall the timeout |
|---|
| 14 | with 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> |
|---|
| 15 | method 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> |
|---|
| 16 | method.</p><p>If you're using a <a href="class-gdkpixbufloader.html" title="gtk.gdk.PixbufLoader"><code class="classname">gtk.gdk.PixbufLoader</code></a>, |
|---|
| 17 | in addition to updating the image after the delay time, you should also |
|---|
| 18 | update 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> |
|---|
| 19 | method returns <code class="literal">True</code>. In this case, the frame currently |
|---|
| 20 | being fed into the loader has received new data, so needs to be refreshed. |
|---|
| 21 | The delay time for a frame may also be modified after an "area_updated" |
|---|
| 22 | signal, for example if the delay time for a frame is encoded in the data |
|---|
| 23 | after the frame itself. So your timeout should be reinstalled after any |
|---|
| 24 | area_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 |
|---|
| 26 | a second)</td></tr></tbody></table><p>The <code class="methodname">get_delay_time</code>() method returns the |
|---|
| 27 | number of milliseconds the current pixbuf should be displayed, or -1 if the |
|---|
| 28 | current pixbuf should be displayed forever. The <PYGTKDOCLINK HREF="function-gobject--timeout-add"><code class="methodname">gobject.timeout_add</code>()</PYGTKDOCLINK>() |
|---|
| 29 | function conveniently takes a timeout in milliseconds, so you can use a |
|---|
| 30 | timeout 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 |
|---|
| 31 | displayed</td></tr></tbody></table><p>The <code class="methodname">get_pixbuf</code>() method returns the |
|---|
| 32 | current <a href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a> that |
|---|
| 33 | should be displayed. The pixbuf will be the same size as the animation |
|---|
| 34 | itself (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> |
|---|
| 35 | and <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> |
|---|
| 36 | methods). The <a href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a> |
|---|
| 37 | should 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> |
|---|
| 38 | method.</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 |
|---|
| 39 | is partially loaded, or the last frame</td></tr></tbody></table><p>The <code class="methodname">on_currently_loading_frame</code>() method |
|---|
| 40 | returns <code class="literal">True</code> if the frame currently pointed to by the |
|---|
| 41 | iterator is partially loaded or the last frame. This method is used to |
|---|
| 42 | determine 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> |
|---|
| 43 | when loading an animation. The "area_updated" signal is emitted for an area |
|---|
| 44 | of the frame currently streaming in to the loader. So if you're on the |
|---|
| 45 | currently loading frame, you need to redraw the screen for the updated |
|---|
| 46 | area.</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 |
|---|
| 47 | automatically 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 |
|---|
| 48 | updating</td></tr></tbody></table><p>The <code class="methodname">advance</code>() method attempts to |
|---|
| 49 | advance an animation to a new frame. The frame is chosen based on the start |
|---|
| 50 | 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> |
|---|
| 51 | method. <em class="parameter"><code>current_time</code></em> is normally the current time (as |
|---|
| 52 | specified by the Python time.time() function) and must be greater than or |
|---|
| 53 | equal 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> |
|---|
| 54 | method, 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> |
|---|
| 55 | method is called. That is, you can't go backward in time; animations only |
|---|
| 56 | play forward. As a shortcut, pass 0.0 (the default) for the current time and |
|---|
| 57 | the current time will automatically be determined an used. So you only need |
|---|
| 58 | to explicitly pass <em class="parameter"><code>current_time</code></em> if you're doing |
|---|
| 59 | something odd like playing the animation at double speed.</p><p>If this method returns <code class="literal">False</code>, there's no need |
|---|
| 60 | to update the animation display, assuming the display had been rendered |
|---|
| 61 | prior 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> |
|---|
| 62 | method 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> |
|---|