.. wxPython Phoenix documentation

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

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

.. include:: headings.inc



.. _wx.adv.Animation:

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

The  :ref:`wx.adv.Animation`  class handles the interface between the animation control and the details of the animation image or data.  
         




         



.. 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.svg" 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="The  wx.adv.Animation  class handles the interface between the animation control and the details of the animation image or data." alt="" coords="5,82,159,111"/> <area shape="rect" id="node2" href="wx.Object.html" title="This is the root class of many of the wxWidgets classes." alt="" coords="33,5,132,34"/> </map> 
   </p>
   </div>

|


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

================================================================================ ================================================================================
:meth:`~wx.adv.Animation.__init__`                                               Constructs a new empty animation object.
:meth:`~wx.adv.Animation.AddHandler`                                             Add a new decoder to the list of animation decoders.
:meth:`~wx.adv.Animation.CleanUpHandlers`                                        Clear out the animation decoder list.
:meth:`~wx.adv.Animation.FindHandler`                                            Search for an animation decoder by type.
: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.GetHandlers`                                            Returns the list of animation decoders used by the generic animation and  :ref:`wx.adv.GenericAnimationCtrl`.
:meth:`~wx.adv.Animation.GetSize`                                                Returns the size of the animation.
:meth:`~wx.adv.Animation.InitStandardHandlers`                                   Load the stock animation decoders (currently ``GIF`` and ``ANI``) into the list of decoders.
:meth:`~wx.adv.Animation.InsertHandler`                                          Insert a new decoder to the front of the list of animation decoders.
:meth:`~wx.adv.Animation.IsCompatibleWith`                                       Returns ``True`` if animation can be used with controls of the given type.
: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() -> None
       
       Animation(name, type=ANIMATION_TYPE_ANY) -> None
       
       Animation(other) -> None
       
   
   The Animation class handles the interface between the animation
   control and the details of the animation image or data.



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



      |overload| **Overloaded Implementations:**

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

      
      **__init__** `(self)`
      
      Constructs a new empty animation object. 
                       
      
      Call :meth:`Load`   to initialize it. 
      
      
                      
      
      :rtype: `None`     
      
      
      
      
      
      
      
      .. seealso:: :meth:`wx.adv.AnimationCtrl.CreateAnimation`     
      
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **__init__** `(self, name, type=ANIMATION_TYPE_ANY)`
      
      Constructs a new animation object and load the animation data from the given filename. 
                       
      
      
      
      
      :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: `None`     
      
      
      
      
                        
      
      
      
      .. seealso:: :meth:`wx.adv.AnimationCtrl.CreateAnimation`     
      
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

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






   .. staticmethod:: AddHandler(handler)

      Add a new decoder to the list of animation decoders. 
                 


      :param `handler`: 
      :type `handler`: wx.adv.AnimationDecoder




      :rtype: `None`     








   .. staticmethod:: CleanUpHandlers()

      Clear out the animation decoder list. 
                 

      This is called automatically at program shutdown. 
                 

      :rtype: `None`     








   .. staticmethod:: FindHandler(animType)

      Search for an animation decoder by type. 
                 


      :param `animType`: 
      :type `animType`: wx.adv.AnimationType




      :rtype: :ref:`wx.adv.AnimationDecoder`








   .. method:: GetDelay(self, frame)

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

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


      :param `frame`: 
      :type `frame`: int




      :rtype: `int`








   .. method:: GetFrame(self, frame)

      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 `frame`: 
      :type `frame`: 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`








   .. staticmethod:: GetHandlers()

      Returns the list of animation decoders used by the generic animation and  :ref:`wx.adv.GenericAnimationCtrl`.  
                 

      :rtype: `AnimationDecoderList`     








   .. method:: GetSize(self)

      Returns the size of the animation. 
                 

      :rtype: `Size`     








   .. staticmethod:: InitStandardHandlers()

      Load the stock animation decoders (currently ``GIF`` and ``ANI``) into the list of decoders. 
                 

      This is called automatically at program startup. 
                 

      :rtype: `None`     








   .. staticmethod:: InsertHandler(handler)

      Insert a new decoder to the front of the list of animation decoders. 
                 


      :param `handler`: 
      :type `handler`: wx.adv.AnimationDecoder




      :rtype: `None`     








   .. method:: IsCompatibleWith(self, ci)

      Returns ``True`` if animation can be used with controls of the given type. 
                 

      This function checks if this animation object can be used with :ref:`wx.adv.AnimationCtrl`  of particular type. This will be always the case for the platforms where only a single :ref:`wx.adv.AnimationCtrl`  implementation is available, but not necessarily under e.g. wxGTK where both native (but limited) GTK implementation and generic implementation can be used. 


                


      :param `ci`: 
      :type `ci`: wx.ClassInfo




      :rtype: `bool`







      .. versionadded:: 4.1/wxWidgets-3.1.4  
     








   .. 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`

