.. wxPython Phoenix documentation

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

   Copyright: (c) 2011-2017 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>
   </div>
   <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,171,35"/> </map> 
   </p>

|


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

================================================================================ ================================================================================
:meth:`~wx.propgrid.PGChoices.__init__`                                          Default constructor.
:meth:`~wx.propgrid.PGChoices.Add`                                               Adds to current.
:meth:`~wx.propgrid.PGChoices.AddAsSorted`                                       Adds 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.GetCount`                                          Returns number of items.
: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 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`                                               Sets contents from lists of strings and values.
: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.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:

      **~~~**

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

      
      **__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
      
      
      
      
      
      
      **~~~**

      
      **__init__** `(self, labels, values=[])`
      
      Constructor.                  
      
      
      :param `labels`: 
      :type `labels`: list of strings
      :param `values`: 
      :type `values`: list of integers
      
      
      
      
      
      
      **~~~**

      
      **__init__** `(self, data)`
      
      Constructor.                  
      
      
      :param `data`: 
      :type `data`: wx.propgrid.PGChoicesData
      
      
      
      
      
      
      **~~~**






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



      |overload| Overloaded Implementations:

      **~~~**

      
      **Add** `(self, labels, values=None)`
      
      Adds to current.                  
      
      If did not have own copies, creates them now. If was empty, identical to set except that creates copies.                  
      
      
      :param `labels`: 
      :type `labels`: string
      :param `values`: 
      :type `values`: ValArrItem
      
      
      
      
      
      
      **~~~**

      
      **Add** `(self, arr, arrint)`
      
      Version that works with :ref:`ArrayString`  and ArrayInt.                  
      
      
      :param `arr`: 
      :type `arr`: list of strings
      :param `arrint`: 
      :type `arrint`: list of integers
      
      
      
      
      
      
      **~~~**

      
      **Add** `(self, label, value=PG_INVALID_VALUE)`
      
      Adds single item.                  
      
      
      :param `label`: 
      :type `label`: string
      :param `value`: 
      :type `value`: int
      
      
      
      
      :rtype: :ref:`wx.propgrid.PGChoiceEntry`
      
      
      
      
      
      
      
      **~~~**

      
      **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`
      
      
      
      
      
      
      
      **~~~**

      
      **Add** `(self, entry)`
      
      Adds a single item with full entry information.                  
      
      
      :param `entry`: 
      :type `entry`: wx.propgrid.PGChoiceEntry
      
      
      
      
      :rtype: :ref:`wx.propgrid.PGChoiceEntry`
      
      
      
      
      
      
      
      **~~~**






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

      Adds 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:: GetCount(self)

      Returns number of items.                  

      :rtype: `int`








   .. 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 ``wx.propgrid.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:

      **~~~**

      
      **Index** `(self, label)`
      
      Returns index of item with given label.                  
      
      
      :param `label`: 
      :type `label`: string
      
      
      
      
      :rtype: `int`
      
      
      
      
      
      
      
      **~~~**

      
      **Index** `(self, val)`
      
      Returns index of item with given value.                  
      
      
      :param `val`: 
      :type `val`: int
      
      
      
      
      :rtype: `int`
      
      
      
      
      
      
      
      **~~~**






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



      |overload| Overloaded Implementations:

      **~~~**

      
      **Insert** `(self, label, index, value=PG_INVALID_VALUE)`
      
      Inserts single item.                  
      
      
      :param `label`: 
      :type `label`: string
      :param `index`: 
      :type `index`: int
      :param `value`: 
      :type `value`: int
      
      
      
      
      :rtype: :ref:`wx.propgrid.PGChoiceEntry`
      
      
      
      
      
      
      
      **~~~**

      
      **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`
      
      
      
      
      
      
      
      **~~~**






   .. 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, *args, **kw)

      Sets contents from lists of strings and values.                   


      |overload| Overloaded Implementations:

      **~~~**

      
      **Set** `(self, labels, values=None)`
      
      
      
      
      :param `labels`: 
      :type `labels`: string
      :param `values`: 
      :type `values`: long
      
      
      
      
      
      
      **~~~**

      
      **Set** `(self, labels, values=[])`
      
      
      
      
      :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:: Labels

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

