Inheritance diagram for wx.ItemContainer:
The wx.ItemContainer class defines an interface which is implemented by all controls which have string subitems, each of which may be selected, such as wx.ListBox and wx.CheckListBox derived from it, wx.Choice and wx.ComboBox, which implements an extended interface deriving from this one.
It defines the methods for accessing the control’s items and although each of the derived classes implements them differently, they still all conform to the same interface.
The items in a wx.ItemContainer have (non empty) string labels and, optionally, client data associated with them.
wx.CheckListBox, wx.Choice, wx.ComboBox, wx.DirFilterListCtrl, wx.ListBox
Adds the item to the control, associating the given data with the item if not None. The return value is the index of the newly added item which may be different from the last one if the control is sorted (e.g. has wx.LB_SORT or wx.CB_SORT style).
Parameters:
Returns:
int
Append several items at once to the control.
Parameters:
Note
Notice that calling this method may be much faster than appending the items one by one if you need to add a lot of items.
Removes all items from the control.
Clear() also deletes the client data of the existing items if it is owned by the control.
See also
Deletes the item at the zero-based index n from the control.
Parameters:
Note
Note that it is an error (signalled by a wx.PyAssertionError exception if enabled) to remove an item with the index negative or greater or equal than the number of items in the control.
See also
Finds an item whose label matches the given string. Returns the zero-based position of the item, or wx.NOT_FOUND if the string was not found.
Parameters:
Returns:
int
Returns a pointer to the client data associated with the given item (if any). It is an error to call this function for a control which doesn’t have untyped client data at all although it is ok to call it even if the given item doesn’t have any client data associated with it (but other items do).
Parameters:
Returns:
PyObject
Returns the number of items in the control.
Returns:
int
See also
Returns a list of items in the control.
Returns:
list of strings
See also
Returns the index of the selected item or wx.NOT_FOUND if no item is selected.
Returns:
int
Note
This method can be used with single selection list boxes only, you should use wx.ListBox.GetSelections for the list boxes with wx.LB_MULTIPLE style.
See also
Returns the item label at the zero-based index n from the control.
Parameters:
Returns:
string
Returns the array of the labels of all items in the control.
Returns:
list of strings
Returns the label of the selected item or an empty string if no item is selected.
Returns:
string
Inserts the item into the list before pos, associating the given client data pointer with the item.
Not valid for wx.LB_SORT or wx.CB_SORT styles, use Append instead.
Parameters:
Returns:
int
Returns True if the control is empty or False if it has some items.
Returns:
bool
See also
This is the same as SetSelection and exists only because it is slightly more natural for controls which support multiple selection
Parameters:
Associates the given client data pointer with the given item.
Parameters:
Note
Note that it is an error to call this function if any typed client data pointers had been associated with the control items before.
Clear and set the strings in the control from a list.
Parameters:
See also
Sets the selection to the given item n or removes the selection entirely if n == wx.NOT_FOUND.
Parameters:
Note
Note that this does not cause any command events to be emitted nor does it deselect any other items in the controls which support multiple selections.
See also
Sets the label for the given item.
Parameters:
Selects the item with the specified string in the control. This doesn’t cause any command events being emitted.
Returns True if the specified string has been selected, False if it wasn’t found in the control.
Parameters:
Returns:
bool
See also