wx.ListView¶
This class currently simply presents a simpler to use interface for the wx.ListCtrl – it can be thought of as a façade for that complicated class.
Using it is preferable to using wx.ListCtrl directly whenever possible because in the future some ports might implement wx.ListView but not the full set of wx.ListCtrl features.
Other than different interface, this class is identical to wx.ListCtrl. In particular, it uses the same events, same window styles and so on.
See also
Class Hierarchy¶
Control Appearance¶
Methods Summary¶
Default constructor. |
|
Resets the column image – after calling this function, no image will be shown. |
|
Sets focus to the item with the given index. |
|
Returns the first selected item in a (presumably) multiple selection control. |
|
Returns the currently focused item or -1 if none. |
|
Used together with |
|
Returns |
|
Selects or unselects the given item. |
|
Sets the column image for the specified column. |
Properties Summary¶
See |
|
See |
Class API¶
- class wx.ListView(ListCtrl)¶
Possible constructors:
ListView() -> None ListView(parent, winid=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=LC_REPORT, validator=DefaultValidator, name=ListCtrlNameStr) -> None
This class currently simply presents a simpler to use interface for the ListCtrl it can be thought of as a façade for that complicated class.
Methods¶
- __init__(self, *args, **kw)¶
-
__init__ (self)
Default constructor.
- Return type:
None
__init__ (self, parent, winid=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=LC_REPORT, validator=DefaultValidator, name=ListCtrlNameStr)
Constructor, creating and showing a listview control.
- Parameters:
parent (wx.Window) – Parent window. Must not be
None
.winid (wx.WindowID) – Window identifier. The value
wx.ID_ANY
indicates a default value.pos (wx.Point) – Window position. If
wx.DefaultPosition
is specified then a default position is chosen.size (wx.Size) – Window size. If
wx.DefaultSize
is specified then the window is sized appropriately.style (long) – Window style. See wx.ListCtrl.
validator (wx.Validator) – Window validator.
name (string) – Window name.
- Return type:
None
See also
- ClearColumnImage(self, col)¶
Resets the column image – after calling this function, no image will be shown.
- Parameters:
col (int) – the column to clear image for
- Return type:
None
See also
- Focus(self, index)¶
Sets focus to the item with the given index.
- Parameters:
index (long)
- Return type:
None
- static GetClassDefaultAttributes(variant=WINDOW_VARIANT_NORMAL)¶
- Parameters:
variant (WindowVariant)
- Return type:
- GetFirstSelected(self)¶
Returns the first selected item in a (presumably) multiple selection control.
Together with
GetNextSelected
it can be used to iterate over all selected items in the control.- Return type:
int
- Returns:
The first selected item, if any, -1 otherwise.
- GetFocusedItem(self)¶
Returns the currently focused item or -1 if none.
- Return type:
int
See also
- GetNextSelected(self, item)¶
Used together with
GetFirstSelected
to iterate over all selected items in the control.- Parameters:
item (long)
- Return type:
int
- Returns:
Returns the next selected item or -1 if there are no more of them.
- IsSelected(self, index)¶
Returns
True
if the item with the given index is selected,False
otherwise.- Parameters:
index (long)
- Return type:
bool
See also
- Select(self, n, on=True)¶
Selects or unselects the given item.
Notice that this method inherits the unusual behaviour of
wx.ListCtrl.SetItemState
which sends a wxEVT_LIST_ITEM_SELECTED event when it is used to select an item, contrary to the usual rule that only the user actions result in selection.- Parameters:
n (long) – the item to select or unselect
on (bool) – if
True
(default), selects the item, otherwise unselects it
- Return type:
None
- SetColumnImage(self, col, image)¶
Sets the column image for the specified column.
To use the column images, the control must have a valid image list with at least one image.
- Parameters:
col (int) – the column to set image for
image (int) – the index of the column image in the controls image list
- Return type:
None
Properties¶
- FirstSelected¶
See
GetFirstSelected
- FocusedItem¶
See
GetFocusedItem