Inheritance diagram for wx.ListBox:
A listbox is used to select one or more of a list of strings. The strings are displayed in a scrolling box, with the selected string(s) marked in reverse video.
A listbox can be single selection (if an item is selected, the previous selection is removed) or multiple selection (clicking an item toggles the item on or off independently of other selections).
List box elements are numbered from zero. Their number may be limited under some platforms.
A listbox callback gets an event wx.wxEVT_COMMAND_LISTBOX_SELECTED for single clicks, and wx.wxEVT_COMMAND_LISTBOX_DOUBLECLICKED for double clicks.
See also
Window Style | Description |
---|---|
wx.LB_SINGLE | Single-selection list. |
wx.LB_MULTIPLE | Multiple-selection list: the user can toggle multiple items on and off. |
wx.LB_EXTENDED | Extended-selection list: the user can select multiple items using the SHIFT key and the mouse or special key combinations. |
wx.LB_HSCROLL | Create horizontal scrollbar if contents are too wide (Windows only). |
wx.LB_ALWAYS_SB | Always show a vertical scrollbar. |
wx.LB_NEEDED_SB | Only create a vertical scrollbar if needed. |
wx.LB_SORT | The listbox contents are sorted in alphabetical order. |
Event Name | Description |
---|---|
wx.EVT_LISTBOX(id, func) | Process a wx.wxEVT_COMMAND_LISTBOX_SELECTED event, when an item on the list is selected or the selection changes. |
wx.EVT_LISTBOX_DCLICK(id, func) | Process a wx.wxEVT_COMMAND_LISTBOX_DOUBLECLICKED event, when the listbox is double-clicked. |
Constructor.
Parameters:
Returns:
Appends a string and ensure the item is visible.
Parameters:
Deselects an item in the list box.
Parameters:
Note
This applies to multiple selection listboxes only.
Deselects all the items except the one specified in itemToLeaveSelected.
Parameters:
Ensures that the item at position n is visible.
Parameters:
Fill an array of integers with the positions of the currently selected items.
Returns:
list of integers
Note
Use this with a multiple selection listbox.
See also
wx.ItemContainer.GetSelection, wx.ItemContainer.GetStringSelection, wx.ItemContainer.SetSelection
Insert the given number of strings before the specified position.
Parameters:
Determines whether an item is selected.
Parameters:
Returns:
bool
Clears the list box and adds the given strings to it.
Parameters:
Note
You may free the array from the calling program after this function has been called.
Set the specified item index to be the first visible item.
Parameters:
Set the specified item string to be the first visible item.
Parameters:
Sets the item background colour.
Parameters: