.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2018 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc



.. _wx.adv.Animation:

==========================================================================================================================================
|phoenix_title|  **wx.adv.Animation**
==========================================================================================================================================

This class encapsulates the concept of a platform-dependent animation.          

An animation is a sequence of frames of the same size. Sound is not supported by :ref:`wx.adv.Animation`. 

Note that on wxGTK :ref:`wx.adv.Animation`  is capable of loading the formats supported by the internally-used  ``gdk-pixbuf``   library (typically this means only   ``ANIMATION_TYPE_GIF`` ). On other platforms  :ref:`wx.adv.Animation`  is always capable of loading both ``GIF`` and ``ANI`` formats (i.e. both  ``ANIMATION_TYPE_GIF``   and   ``ANIMATION_TYPE_ANI`` ). 









         



.. seealso:: :ref:`wx.adv.AnimationCtrl`, :ref:`Animation Sample <animation sample>`    







|

|class_hierarchy| Class Hierarchy
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>Animation</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.adv.Animation_inheritance.png" alt="Inheritance diagram of Animation" usemap="#dummy" class="inheritance"/></center>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.adv.Animation.html" title="This class encapsulates the concept of a platform-dependent animation." alt="" coords="5,83,147,112"/> <area shape="rect" id="node2" href="wx.Object.html" title="This is the root class of many of the wxWidgets classes." alt="" coords="32,5,120,35"/> </map> 
   </p>
   </div>

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.adv.Animation.__init__`                                               Default constructor.
:meth:`~wx.adv.Animation.GetDelay`                                               Returns the delay for the i-th frame in milliseconds.
:meth:`~wx.adv.Animation.GetFrame`                                               Returns the i-th frame as a :ref:`wx.Image`.
:meth:`~wx.adv.Animation.GetFrameCount`                                          Returns the number of frames for this animation.
:meth:`~wx.adv.Animation.GetSize`                                                Returns the size of the animation.
:meth:`~wx.adv.Animation.IsOk`                                                   Returns ``True`` if animation data is present.
:meth:`~wx.adv.Animation.Load`                                                   Loads an animation from the given stream.
:meth:`~wx.adv.Animation.LoadFile`                                               Loads an animation from a file.
================================================================================ ================================================================================


|


|property_summary| Properties Summary
=====================================

================================================================================ ================================================================================
:attr:`~wx.adv.Animation.FrameCount`                                             See :meth:`~wx.adv.Animation.GetFrameCount`
:attr:`~wx.adv.Animation.Size`                                                   See :meth:`~wx.adv.Animation.GetSize`
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: wx.adv.Animation(Object)

   **Possible constructors**::

       Animation()
       
       Animation(anim)
       
       Animation(name, type=ANIMATION_TYPE_ANY)
       
   
   This class encapsulates the concept of a platform-dependent animation.



   .. method:: __init__(self, *args, **kw)



      |overload| Overloaded Implementations:

      :html:`<hr class="overloadsep" /><br />`

      
      **__init__** `(self)`
      
      Default constructor.                   
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **__init__** `(self, anim)`
      
      Copy constructor.                  
      
      
      :param `anim`: 
      :type `anim`: wx.adv.Animation
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **__init__** `(self, name, type=ANIMATION_TYPE_ANY)`
      
      Loads an animation from a file.                  
      
      
      
      
      :param `name`: The name of the file to load.   
      :type `name`: string
      :param `type`: See :meth:`LoadFile`   for more info.   
      :type `type`: wx.adv.AnimationType
      
      
      
      
      
      
                        
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`






   .. method:: GetDelay(self, i)

      Returns the delay for the i-th frame in milliseconds.                  

      If  ``-1``   is returned the frame is to be displayed forever.                   


      :param `i`: 
      :type `i`: int




      :rtype: `int`








   .. method:: GetFrame(self, i)

      Returns the i-th frame as a :ref:`wx.Image`.                  

      This method is not implemented in the native wxGTK implementation of this class and always returns an invalid image there.                  


      :param `i`: 
      :type `i`: int




      :rtype: `Image`     








   .. method:: GetFrameCount(self)

      Returns the number of frames for this animation.                  

      This method is not implemented in the native wxGTK implementation of this class and always returns 0 there.                  

      :rtype: `int`








   .. method:: GetSize(self)

      Returns the size of the animation.                  

      :rtype: `Size`     








   .. method:: IsOk(self)

      Returns ``True`` if animation data is present.                  

      :rtype: `bool`








   .. method:: Load(self, stream, type=ANIMATION_TYPE_ANY)

      Loads an animation from the given stream.                  




      :param `stream`: The stream to use to load the animation. Under wxGTK may be any kind of stream; under other platforms this must be a seekable stream.   
      :type `stream`: wx.InputStream
      :param `type`: One of the :ref:`wx.adv.AnimationType`  enumeration values.  
      :type `type`: wx.adv.AnimationType








      :rtype: `bool`



                  



      :returns: 

         ``True`` if the operation succeeded, ``False`` otherwise.   








   .. method:: LoadFile(self, name, type=ANIMATION_TYPE_ANY)

      Loads an animation from a file.                  




      :param `name`: A filename.   
      :type `name`: string
      :param `type`: One of the :ref:`wx.adv.AnimationType`  values; ``wx.adv.ANIMATION_TYPE_ANY`` means that the function should try to autodetect the filetype.  
      :type `type`: wx.adv.AnimationType








      :rtype: `bool`



                  



      :returns: 

         ``True`` if the operation succeeded, ``False`` otherwise.   








   .. attribute:: FrameCount

      See :meth:`~wx.adv.Animation.GetFrameCount`


   .. attribute:: Size

      See :meth:`~wx.adv.Animation.GetSize`