GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing docs.wxpython.org — wx.ListBox — wxPython 4.3.2 Docs
|
Default constructor. |
|
Creates the listbox for two-step construction. |
|
Deselects an item in the list box. |
|
Ensure that the item with the given index is currently shown. |
|
Finds an item whose label matches the given string. |
|
Returns the number of items in the control. |
|
Return the number of items that can fit vertically in the visible area of the listbox. |
|
Returns the index of the selected item or |
|
Fill an array of ints with the positions of the currently selected items. |
|
Returns the label of the item with the given index. |
|
Return the index of the topmost visible item. |
|
return |
|
Returns the item located at point, or |
|
Insert the given number of strings before the specified position. |
|
Determines whether an item is selected. |
|
Return |
|
Set the specified item to be the first visible item. |
|
Set the background colour of an item in the ListBox. |
|
Set the font of an item in the ListBox. |
|
Set the foreground colour of an item in the ListBox. |
|
Sets the selection to the given item n or removes the selection entirely if n == |
|
Sets the label for the given item. |
|
Properties Summary¶See |
|
See |
|
See |
|
See |
|
See |
Class API¶Possible constructors:
ListBox() -> None ListBox(parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, choices=[], style=0, validator=DefaultValidator, name=ListBoxNameStr) -> None
A listbox is used to select one or more of a list of strings.
__init__ (self)
Default constructor.
None
__init__ (self, parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, choices=[], style=0, validator=DefaultValidator, name=ListBoxNameStr)
Constructor, creating and showing a list box.
See the other wx.ListBox constructor; the only difference is that this overload takes a list of strings instead of a pointer to an array of String .
Creates the listbox for two-step construction.
See wx.ListBox for further details.
parent (wx.Window)
id (wx.WindowID)
pos (wx.Point)
size (wx.Size)
choices (list of strings)
style (long)
validator (wx.Validator)
name (string)
bool
Deselects an item in the list box.
n (int) – The zero-based item to deselect.
None
Note
This applies to multiple selection listboxes only.
Ensure that the item with the given index is currently shown.
This method scrolls the listbox only if necessary and doesn’t do anything if this item is already shown, unlike SetFirstItem .
n (int)
None
Finds an item whose label matches the given string.
string (string) – String to find.
caseSensitive (bool) – Whether search is case sensitive (default is not).
int
The zero-based position of the item, or wx.NOT_FOUND if the string was not found.
variant (WindowVariant)
Returns the number of items in the control.
int
See also
IsEmpty
Return the number of items that can fit vertically in the visible area of the listbox.
Returns -1 if the number of items per page couldn’t be determined. On wxGTK this method can only determine the number of items per page if there is at least one item in the listbox.
int
Added in version 4.1/wxWidgets-3.1.0.
Returns the index of the selected item or NOT_FOUND if no item is selected.
int
The position of the current selection.
Note
This method can be used with single selection list boxes only, you must use wx.ListBox.GetSelections for the list boxes with wx.LB_MULTIPLE style.
See also
SetSelection , GetStringSelection
Fill an array of ints with the positions of the currently selected items.
List[int]
Returns the label of the item with the given index.
The index must be valid, i.e. less than the value returned by GetCount , otherwise an assert is triggered. Notably, this function can’t be called if the control is empty.
n (int) – The zero-based index.
str
The label of the item.
Return the index of the topmost visible item.
Returns NOT_FOUND if the method is not implemented for the current platform.
int
Added in version 4.1/wxWidgets-3.1.0.
return True if the listbox allows multiple selection
bool
HitTest (self, point)
Returns the item located at point, or NOT_FOUND if there is no item located at point.
It is currently implemented for wxMSW, Mac and wxGTK2 ports.
point (wx.Point) – Point of item (in client coordinates) to obtain
int
Item located at point, or wx.NOT_FOUND if unimplemented or the item does not exist.
Added in version 2.7.0.
HitTest (self, x, y)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
x (int)
y (int)
int
Insert the given number of strings before the specified position.
items (list of strings) – Labels of items to be inserted
pos (int) – Position before which to insert the items: if pos is 0 the items will be inserted in the beginning of the listbox
None
Determines whether an item is selected.
n (int) – The zero-based item index.
bool
True if the given item is selected, False otherwise.
Return True if the listbox has LB_SORT style.
This method is mostly meant for internal use only.
bool
None
SetFirstItem (self, n)
Set the specified item to be the first visible item.
n (int) – The zero-based item index that should be visible.
None
SetFirstItem (self, string)
Set the specified item to be the first visible item.
string (string) – The string that should be visible.
None
Set the background colour of an item in the ListBox. Only valid on MSW and if the
wx.LB_OWNERDRAWflag is set.
None
Set the font of an item in the ListBox. Only valid on MSW and if the
wx.LB_OWNERDRAWflag is set.
None
Set the foreground colour of an item in the ListBox. Only valid on MSW and if the
wx.LB_OWNERDRAWflag is set.
None
Sets the selection to the given item n or removes the selection entirely if n == NOT_FOUND .
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.
n (int) – The string position to select, starting from zero.
None
See also
Sets the label for the given item.
n (int) – The zero-based item index.
string (string) – The label to set.
None
SetStringSelection (self, s, select)
s (string)
select (bool)
bool
SetStringSelection (self, s)
s (string)
bool
See GetCountPerPage
See GetSelection and SetSelection
See GetSelections
See GetTopItem