.. 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.propgrid.PGChoices:

==========================================================================================================================================
|phoenix_title|  **wx.propgrid.PGChoices**
==========================================================================================================================================

Helper class for managing choices of :ref:`wx.propgrid.PropertyGrid`  properties.          

Each entry can have label, value, bitmap, text colour, and background colour. 

:ref:`wx.propgrid.PGChoices`  uses reference counting, similar to other wxWidgets classes. This means that assignment operator and copy constructor only copy the reference and not the actual data. Use :meth:`~wx.propgrid.PGChoices.Copy`  member function to create a real copy. 







.. note:: 

   If you do not specify value for entry, index is used.  







|

|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>PGChoices</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.propgrid.PGChoices_inheritance.png" alt="Inheritance diagram of PGChoices" 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.propgrid.PGChoices.html" title="wx.propgrid.PGChoices" alt="" coords="5,5,177,35"/> </map> 
   </p>
   </div>

|


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

================================================================================ ================================================================================
:meth:`~wx.propgrid.PGChoices.__init__`                                          Default constructor.
:meth:`~wx.propgrid.PGChoices.Add`                                               This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
:meth:`~wx.propgrid.PGChoices.AddAsSorted`                                       Adds a single item, sorted.
:meth:`~wx.propgrid.PGChoices.AllocExclusive`                                    Creates exclusive copy of current choices.
:meth:`~wx.propgrid.PGChoices.Assign`                                            Assigns choices data, using reference counting.
:meth:`~wx.propgrid.PGChoices.AssignData`                                        Assigns data from another set of choices.
:meth:`~wx.propgrid.PGChoices.Clear`                                             Deletes all items.
:meth:`~wx.propgrid.PGChoices.Copy`                                              Returns a real copy of the choices.
:meth:`~wx.propgrid.PGChoices.EnsureData`                                        
:meth:`~wx.propgrid.PGChoices.ExtractData`                                       Changes ownership of data to you.
:meth:`~wx.propgrid.PGChoices.GetCount`                                          Returns number of items.
:meth:`~wx.propgrid.PGChoices.GetData`                                           Returns data, increases refcount.
:meth:`~wx.propgrid.PGChoices.GetDataPtr`                                        Returns plain data ptr - no refcounting stuff is done.
:meth:`~wx.propgrid.PGChoices.GetId`                                             Gets an  number identifying this list.
:meth:`~wx.propgrid.PGChoices.GetIndicesForStrings`                              Returns array of indices matching given strings.
:meth:`~wx.propgrid.PGChoices.GetLabel`                                          Returns label of item.
:meth:`~wx.propgrid.PGChoices.GetLabels`                                         Returns array of choice labels.
:meth:`~wx.propgrid.PGChoices.GetValue`                                          Returns value of item.
:meth:`~wx.propgrid.PGChoices.GetValuesForStrings`                               Returns array of values matching the given strings.
:meth:`~wx.propgrid.PGChoices.Index`                                             Returns index of item with given label.
:meth:`~wx.propgrid.PGChoices.Insert`                                            Inserts a single item.
:meth:`~wx.propgrid.PGChoices.IsOk`                                              Returns ``False`` if this is a constant empty set of choices, which should not be modified.
:meth:`~wx.propgrid.PGChoices.Item`                                              Returns item at given index.
:meth:`~wx.propgrid.PGChoices.RemoveAt`                                          Removes count items starting at position nIndex.
:meth:`~wx.propgrid.PGChoices.Set`                                               This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
:meth:`~wx.propgrid.PGChoices.__getitem__`                                       Returns a reference to a :class:PGChoiceEntry using Python list syntax.
:meth:`~wx.propgrid.PGChoices.__len__`                                           
================================================================================ ================================================================================


|


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

================================================================================ ================================================================================
:attr:`~wx.propgrid.PGChoices.Count`                                             See :meth:`~wx.propgrid.PGChoices.GetCount`
:attr:`~wx.propgrid.PGChoices.Data`                                              See :meth:`~wx.propgrid.PGChoices.GetData`
:attr:`~wx.propgrid.PGChoices.DataPtr`                                           See :meth:`~wx.propgrid.PGChoices.GetDataPtr`
:attr:`~wx.propgrid.PGChoices.Id`                                                See :meth:`~wx.propgrid.PGChoices.GetId`
:attr:`~wx.propgrid.PGChoices.Labels`                                            See :meth:`~wx.propgrid.PGChoices.GetLabels`
================================================================================ ================================================================================


|


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


.. class:: wx.propgrid.PGChoices(object)

   **Possible constructors**::

       PGChoices()
       
       PGChoices(a)
       
       PGChoices(labels, values=[])
       
       PGChoices(data)
       
   
   Helper class for managing choices of PropertyGrid properties.



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



      |overload| Overloaded Implementations:

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

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

      
      **__init__** `(self, a)`
      
      Copy constructor, uses reference counting.                  
      
      To create a real copy, use :meth:`Copy`   member function instead.                  
      
      
      :param `a`: 
      :type `a`: wx.propgrid.PGChoices
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **__init__** `(self, labels, values=[])`
      
      Constructor.                  
      
      
      
      
      :param `labels`: Labels for choices.  
      :type `labels`: list of strings
      :param `values`: Values for choices. If empty, indexes are used. Otherwise must have at least the same size as  `labels`.   
      :type `values`: list of integers
      
      
      
      
      
      
                        
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **__init__** `(self, data)`
      
      Simple interface constructor.                  
      
      
      :param `data`: 
      :type `data`: wx.propgrid.PGChoicesData
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`






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



      |overload| Overloaded Implementations:

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

      
      **Add** `(self, arr, arrint)`
      
      This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.                  
      
      
      :param `arr`: 
      :type `arr`: list of strings
      :param `arrint`: 
      :type `arrint`: list of integers
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **Add** `(self, label, value=PG_INVALID_VALUE)`
      
      Adds a single choice item.                  
      
      
      
      
      :param `label`: Label for added choice.  
      :type `label`: string
      :param `value`: Value for added choice. If unspecified, index is used.   
      :type `value`: int
      
      
      
      
      
      
      
      
      :rtype: :ref:`wx.propgrid.PGChoiceEntry`
      
      
      
                        
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **Add** `(self, label, bitmap, value=PG_INVALID_VALUE)`
      
      Adds a single item, with bitmap.                  
      
      
      :param `label`: 
      :type `label`: string
      :param `bitmap`: 
      :type `bitmap`: wx.Bitmap
      :param `value`: 
      :type `value`: int
      
      
      
      
      :rtype: :ref:`wx.propgrid.PGChoiceEntry`
      
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **Add** `(self, entry)`
      
      Adds a single item with full entry information.                  
      
      
      :param `entry`: 
      :type `entry`: wx.propgrid.PGChoiceEntry
      
      
      
      
      :rtype: :ref:`wx.propgrid.PGChoiceEntry`
      
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`






   .. method:: AddAsSorted(self, label, value=PG_INVALID_VALUE)

      Adds a single item, sorted.                  


      :param `label`: 
      :type `label`: string
      :param `value`: 
      :type `value`: int




      :rtype: :ref:`wx.propgrid.PGChoiceEntry`








   .. method:: AllocExclusive(self)

      Creates exclusive copy of current choices.                   





   .. method:: Assign(self, a)

      Assigns choices data, using reference counting.                  

      To create a real copy, use :meth:`Copy`   member function instead.                  


      :param `a`: 
      :type `a`: wx.propgrid.PGChoices







   .. method:: AssignData(self, data)

      Assigns data from another set of choices.                  


      :param `data`: 
      :type `data`: wx.propgrid.PGChoicesData







   .. method:: Clear(self)

      Deletes all items.                   





   .. method:: Copy(self)

      Returns a real copy of the choices.                  

      :rtype: :ref:`wx.propgrid.PGChoices`








   .. method:: EnsureData(self)






   .. method:: ExtractData(self)

      Changes ownership of data to you.                  

      :rtype: :ref:`wx.propgrid.PGChoicesData`








   .. method:: GetCount(self)

      Returns number of items.                  

      :rtype: `int`








   .. method:: GetData(self)

      Returns data, increases refcount.                  

      :rtype: :ref:`wx.propgrid.PGChoicesData`








   .. method:: GetDataPtr(self)

      Returns plain data ptr - no refcounting stuff is done.                  

      :rtype: :ref:`wx.propgrid.PGChoicesData`








   .. method:: GetId(self)

      Gets an  number identifying this list.                  

      :rtype: :ref:`wx.IntPtr`








   .. method:: GetIndicesForStrings(self, strings, unmatched=None)

      Returns array of indices matching given strings.                  

      Unmatching strings are added to 'unmatched', if not ``None``.                  


      :param `strings`: 
      :type `strings`: list of strings
      :param `unmatched`: 
      :type `unmatched`: list of strings




      :rtype: `list of integers`








   .. method:: GetLabel(self, ind)

      Returns label of item.                  


      :param `ind`: 
      :type `ind`: int




      :rtype: `string`








   .. method:: GetLabels(self)

      Returns array of choice labels.                  

      :rtype: `list of strings`








   .. method:: GetValue(self, ind)

      Returns value of item.                  


      :param `ind`: 
      :type `ind`: int




      :rtype: `int`








   .. method:: GetValuesForStrings(self, strings)

      Returns array of values matching the given strings.                  

      Unmatching strings result in ``PG_INVALID_VALUE``  entry in array.                  


      :param `strings`: 
      :type `strings`: list of strings




      :rtype: `list of integers`








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



      |overload| Overloaded Implementations:

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

      
      **Index** `(self, label)`
      
      Returns index of item with given label.                  
      
      
      :param `label`: 
      :type `label`: string
      
      
      
      
      :rtype: `int`
      
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **Index** `(self, val)`
      
      Returns index of item with given value.                  
      
      
      :param `val`: 
      :type `val`: int
      
      
      
      
      :rtype: `int`
      
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`






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



      |overload| Overloaded Implementations:

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

      
      **Insert** `(self, label, index, value=PG_INVALID_VALUE)`
      
      Inserts a single item.                  
      
      
      :param `label`: 
      :type `label`: string
      :param `index`: 
      :type `index`: int
      :param `value`: 
      :type `value`: int
      
      
      
      
      :rtype: :ref:`wx.propgrid.PGChoiceEntry`
      
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **Insert** `(self, entry, index)`
      
      Inserts a single item with full entry information.                  
      
      
      :param `entry`: 
      :type `entry`: wx.propgrid.PGChoiceEntry
      :param `index`: 
      :type `index`: int
      
      
      
      
      :rtype: :ref:`wx.propgrid.PGChoiceEntry`
      
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`






   .. method:: IsOk(self)

      Returns ``False`` if this is a constant empty set of choices, which should not be modified.                  

      :rtype: `bool`








   .. method:: Item(self, i)

      Returns item at given index.                  


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




      :rtype: :ref:`wx.propgrid.PGChoiceEntry`








   .. method:: RemoveAt(self, nIndex, count=1)

      Removes count items starting at position nIndex.                  


      :param `nIndex`: 
      :type `nIndex`: int
      :param `count`: 
      :type `count`: int







   .. method:: Set(self, labels, values=[])

      This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.                  


      :param `labels`: 
      :type `labels`: list of strings
      :param `values`: 
      :type `values`: list of integers







   .. method:: __getitem__(self, index)

      Returns a reference to a :class:PGChoiceEntry using Python list syntax.



   .. method:: __len__(self)




   .. attribute:: Count

      See :meth:`~wx.propgrid.PGChoices.GetCount`


   .. attribute:: Data

      See :meth:`~wx.propgrid.PGChoices.GetData`


   .. attribute:: DataPtr

      See :meth:`~wx.propgrid.PGChoices.GetDataPtr`


   .. attribute:: Id

      See :meth:`~wx.propgrid.PGChoices.GetId`


   .. attribute:: Labels

      See :meth:`~wx.propgrid.PGChoices.GetLabels`

