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

Inheritance diagram for class
PGChoices:
|
|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() -> None
PGChoices(a : PGChoices) -> None
PGChoices(labels : List[str], values: List[int]=[]) -> None
PGChoices(data : PGChoicesData) -> None
Helper class for managing choices of PropertyGrid properties.
.. method:: __init__(self, *args, **kw)
|overload| **Overloaded Implementations:**
:html:`
`
**__init__** `(self)`
Default constructor.
:rtype: `None`
:html:`
`
**__init__** `(self, a : PGChoices)`
Copy constructor, uses reference counting.
To create a real copy, use :meth:`Copy` member function instead.
:param `a`:
:type `a`: wx.propgrid.PGChoices
:rtype: `None`
:html:`
`
**__init__** `(self, labels : List[str], values: List[int]=[])`
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
:rtype: `None`
:html:`
`
**__init__** `(self, data : PGChoicesData)`
Simple interface constructor.
:param `data`:
:type `data`: wx.propgrid.PGChoicesData
:rtype: `None`
:html:`
`
.. method:: Add(self, *args, **kw)
|overload| **Overloaded Implementations:**
:html:`
`
**Add** `(self, arr : List[str], arrint : List[int])`
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
:rtype: `None`
:html:`
`
**Add** `(self, label : str, value: int=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:`
`
**Add** `(self, label : str, bitmap : Bitmap, value: int=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:`
`
**Add** `(self, entry : PGChoiceEntry)`
Adds a single item with full entry information.
:param `entry`:
:type `entry`: wx.propgrid.PGChoiceEntry
:rtype: :ref:`wx.propgrid.PGChoiceEntry`
:html:`
`
.. method:: AddAsSorted(self, label : str, value: int=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.
:rtype: `None`
.. method:: Assign(self, a : PGChoices)
Assigns choices data, using reference counting.
To create a real copy, use :meth:`Copy` member function instead.
:param `a`:
:type `a`: wx.propgrid.PGChoices
:rtype: `None`
.. method:: AssignData(self, data : PGChoicesData)
Assigns data from another set of choices.
:param `data`:
:type `data`: wx.propgrid.PGChoicesData
:rtype: `None`
.. method:: Clear(self)
Deletes all items.
:rtype: `None`
.. method:: Copy(self)
Returns a real copy of the choices.
:rtype: :ref:`wx.propgrid.PGChoices`
.. method:: EnsureData(self)
:rtype: `None`
.. 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: `wx.IntPtr`
.. method:: GetIndicesForStrings(self, strings : List[str], unmatched: Optional[List[str]]=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[int]`
.. method:: GetLabel(self, ind : int)
Returns label of item.
:param `ind`:
:type `ind`: int
:rtype: `str`
.. method:: GetLabels(self)
Returns array of choice labels.
:rtype: `List[str]`
.. method:: GetValue(self, ind : int)
Returns value of item.
:param `ind`:
:type `ind`: int
:rtype: `int`
.. method:: GetValuesForStrings(self, strings : List[str])
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[int]`
.. method:: Index(self, *args, **kw)
|overload| **Overloaded Implementations:**
:html:`
`
**Index** `(self, label : str)`
Returns index of item with given label.
:param `label`:
:type `label`: string
:rtype: `int`
:html:`
`
**Index** `(self, val : int)`
Returns index of item with given value.
:param `val`:
:type `val`: int
:rtype: `int`
:html:`
`
.. method:: Insert(self, *args, **kw)
|overload| **Overloaded Implementations:**
:html:`
`
**Insert** `(self, label : str, index : int, value: int=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:`
`
**Insert** `(self, entry : PGChoiceEntry, index : int)`
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:`
`
.. 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 : int)
Returns item at given index.
:param `i`:
:type `i`: int
:rtype: :ref:`wx.propgrid.PGChoiceEntry`
.. method:: RemoveAt(self, nIndex : int, count: int=1)
Removes count items starting at position nIndex.
:param `nIndex`:
:type `nIndex`: int
:param `count`:
:type `count`: int
:rtype: `None`
.. method:: Set(self, labels : List[str], values: List[int]=[])
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
:rtype: `None`
.. 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`