.. 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.IconBundle:

==========================================================================================================================================
|phoenix_title|  **wx.IconBundle**
==========================================================================================================================================

This class contains multiple copies of an icon in different sizes.          

It is typically used in :meth:`wx.Dialog.SetIcons`   and :meth:`wx.TopLevelWindow.SetIcons` . 











|

|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>IconBundle</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.IconBundle_inheritance.png" alt="Inheritance diagram of IconBundle" usemap="#dummy" class="inheritance"/></center>
   </div>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.Object.html" title="wx.Object" alt="" coords="19,5,100,35"/> <area shape="rect" id="node3" href="wx.GDIObject.html" title="wx.GDIObject" alt="" coords="7,83,113,112"/> <area shape="rect" id="node2" href="wx.IconBundle.html" title="wx.IconBundle" alt="" coords="4,160,115,189"/> </map> 
   </p>

|


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

================================================================================ ================================================================================
:meth:`~wx.IconBundle.__init__`                                                  Default constructor.
:meth:`~wx.IconBundle.AddIcon`                                                   Adds all the icons contained in the file to the bundle; if the collection already contains icons with the same width and height, they are replaced by the new ones.
:meth:`~wx.IconBundle.GetIcon`                                                   Returns the icon with the given size.
:meth:`~wx.IconBundle.GetIconByIndex`                                            return the icon at index (must be < :meth:`~IconBundle.GetIconCount` )
:meth:`~wx.IconBundle.GetIconCount`                                              return the number of available icons
:meth:`~wx.IconBundle.GetIconOfExactSize`                                        Returns the icon with exactly the given size or :ref:`wx.NullIcon`  if this size is not available.
:meth:`~wx.IconBundle.IsEmpty`                                                   Returns ``True`` if the bundle doesn't contain any icons, ``False`` otherwise (in which case a call to :meth:`~IconBundle.GetIcon`   with default parameter should return a valid icon).
================================================================================ ================================================================================


|


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

================================================================================ ================================================================================
:attr:`~wx.IconBundle.Icon`                                                      See :meth:`~wx.IconBundle.GetIcon`
:attr:`~wx.IconBundle.IconCount`                                                 See :meth:`~wx.IconBundle.GetIconCount`
================================================================================ ================================================================================


|


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


.. class:: wx.IconBundle(GDIObject)

   **Possible constructors**::

       IconBundle()
       
       IconBundle(file, type=BITMAP_TYPE_ANY)
       
       IconBundle(stream, type=BITMAP_TYPE_ANY)
       
       IconBundle(icon)
       
       IconBundle(ic)
       
   
   This class contains multiple copies of an icon in different sizes.



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



      |overload| Overloaded Implementations:

      **~~~**

      
      **__init__** `(self)`
      
      Default constructor.                   
      
      
      
      
      **~~~**

      
      **__init__** `(self, file, type=BITMAP_TYPE_ANY)`
      
      Initializes the bundle with the icon(s) found in the file.                  
      
      
      :param `file`: 
      :type `file`: string
      :param `type`: 
      :type `type`: wx.BitmapType
      
      
      
      
      
      
      **~~~**

      
      **__init__** `(self, stream, type=BITMAP_TYPE_ANY)`
      
      Initializes the bundle with the icon(s) found in the stream.                  
      
      Notice that the `stream`  must be seekable, at least if it contains more than one icon. The stream pointer is positioned after the last icon read from the stream when this function returns. 
      
                      
      
      
      :param `stream`: 
      :type `stream`: wx.InputStream
      :param `type`: 
      :type `type`: wx.BitmapType
      
      
      
      
      
      
      .. versionadded:: 2.9.0 
           
      
      
      
      
      
      
      
      **~~~**

      
      **__init__** `(self, icon)`
      
      Initializes the bundle with a single icon.                  
      
      
      :param `icon`: 
      :type `icon`: wx.Icon
      
      
      
      
      
      
      **~~~**

      
      **__init__** `(self, ic)`
      
      Copy constructor.                  
      
      
      :param `ic`: 
      :type `ic`: wx.IconBundle
      
      
      
      
      
      
      **~~~**






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



      |overload| Overloaded Implementations:

      **~~~**

      
      **AddIcon** `(self, file, type=BITMAP_TYPE_ANY)`
      
      Adds all the icons contained in the file to the bundle; if the collection already contains icons with the same width and height, they are replaced by the new ones.                  
      
      
      :param `file`: 
      :type `file`: string
      :param `type`: 
      :type `type`: wx.BitmapType
      
      
      
      
      
      
      **~~~**

      
      **AddIcon** `(self, stream, type=BITMAP_TYPE_ANY)`
      
      Adds all the icons contained in the stream to the bundle; if the collection already contains icons with the same width and height, they are replaced by the new ones.                  
      
      Notice that, as well as in the constructor loading the icon bundle from stream, the `stream`  must be seekable, at least if more than one icon is to be loaded from it. 
      
                      
      
      
      :param `stream`: 
      :type `stream`: wx.InputStream
      :param `type`: 
      :type `type`: wx.BitmapType
      
      
      
      
      
      
      .. versionadded:: 2.9.0 
           
      
      
      
      
      
      
      
      **~~~**

      
      **AddIcon** `(self, icon)`
      
      Adds the icon to the collection; if the collection already contains an icon with the same width and height, it is replaced by the new one.                  
      
      
      :param `icon`: 
      :type `icon`: wx.Icon
      
      
      
      
      
      
      **~~~**






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



      |overload| Overloaded Implementations:

      **~~~**

      
      **GetIcon** `(self, size, flags=FALLBACK_SYSTEM)`
      
      Returns the icon with the given size.                  
      
      If `size`  is :ref:`wx.DefaultSize`, it is interpreted as the standard system icon size, i.e. the size returned by :meth:`wx.SystemSettings.GetMetric`   for  ``SYS_ICON_X``   and   ``SYS_ICON_Y`` . 
      
      If the bundle contains an icon with exactly the requested size, it's always returned. Otherwise, the behaviour depends on the flags. If only :meth:`wx.IconBundle.FALLBACK_NONE`   is given, the function returns an invalid icon. If :meth:`wx.IconBundle.FALLBACK_SYSTEM`   is given, it tries to find the icon of standard system size, regardless of the size passed as parameter. Otherwise, or if the icon system size is not found neither, but :meth:`wx.IconBundle.FALLBACK_NEAREST_LARGER`   flag is specified, the function returns the smallest icon of the size larger than the requested one or, if this fails too, just the icon closest to the specified size. 
      
      The `flags`  parameter is available only since wxWidgets 2.9.4.                  
      
      
      :param `size`: 
      :type `size`: wx.Size
      :param `flags`: 
      :type `flags`: int
      
      
      
      
      :rtype: :ref:`wx.Icon`
      
      
      
      
      
      
      
      **~~~**

      
      **GetIcon** `(self, size=DefaultCoord, flags=FALLBACK_SYSTEM)`
      
      Same as.                  
      
      ::
      
           GetIcon(wx.Size(size, size))
      
                       
      
      
      :param `size`: 
      :type `size`: int
      :param `flags`: 
      :type `flags`: int
      
      
      
      
      :rtype: :ref:`wx.Icon`
      
      
      
      
      
      
      
      **~~~**






   .. method:: GetIconByIndex(self, n)

      return the icon at index (must be < :meth:`GetIconCount` )                  


      :param `n`: 
      :type `n`: int




      :rtype: :ref:`wx.Icon`








   .. method:: GetIconCount(self)

      return the number of available icons                  

      :rtype: `int`








   .. method:: GetIconOfExactSize(self, size)

      Returns the icon with exactly the given size or :ref:`wx.NullIcon`  if this size is not available.                  


      :param `size`: 
      :type `size`: wx.Size




      :rtype: :ref:`wx.Icon`








   .. method:: IsEmpty(self)

      Returns ``True`` if the bundle doesn't contain any icons, ``False`` otherwise (in which case a call to :meth:`GetIcon`   with default parameter should return a valid icon).                  

      :rtype: `bool`








   .. attribute:: Icon

      See :meth:`~wx.IconBundle.GetIcon`


   .. attribute:: IconCount

      See :meth:`~wx.IconBundle.GetIconCount`

