panel_listctrl
A custom Panel that acts as a ListCtrl for other wx.Panel objects.
An example ListItem exists that provides two StaticText fields and can be used as the basis for custom list items
Classes:
|
|
|
|
-
class
PanelListCtrl
(parent, id=- 1, pos=(- 1, - 1), size=(- 1, - 1), style=524288, name=b'panel', left_padding=32)[source] Bases:
ScrolledWindow
Methods:
Append
(panel_list_item)Append a ‘PanelListItem’ object, or an instance of a custom subclass, to the control.
AppendNewItem
(text_dict, style_data)Append a new ‘PanelListItem’ object to the control, passing the ‘text_dict’ and ‘style_data’ parameters to the new object.
Clear
()Removes all items from the control
DeleteItem
(item)Deletes the specified item from the control.
Deselect all items.
Focus
(idx)Set Focus to the the given item.
Returns the number of columns.
GetFirstSelected
(*_)Returns the first selected item, or -1 when none is selected.
Gets the currently focused item or -1 if none is focused.
GetItem
(itemIdx, *_)Returns information about the item.
GetItemBackgroundColour
(item)Returns the colour for this item.
Returns the number of items in the list control.
GetItemPosition
(item)Returns the position of the item, or
-1
if it is not found.GetNextSelected
(item)Returns subsequent selected items, or -1 when no more are selected.
Returns the number of selected items in the list control.
IsEmpty
()Returns true if the control doesn’t currently contain any items.
IsSelected
(idx)Returns
:py:obj:`True`
if the item is selected.RefreshItem
(item)Redraws the given item.
RefreshItems
(itemFrom, itemTo)Redraws the items between itemFrom and itemTo.
Select
(idx[, on])Selects/deselects an item.
SetSelection
(idx)Set the current selection to the item at the given index.
Attributes:
Returns the number of columns.
Gets the currently focused item or -1 if none is focused.
Returns the number of items in the list control.
-
Append
(panel_list_item)[source] Append a ‘PanelListItem’ object, or an instance of a custom subclass, to the control.
-
AppendNewItem
(text_dict, style_data)[source] Append a new ‘PanelListItem’ object to the control, passing the ‘text_dict’ and ‘style_data’ parameters to the new object.
- Parameters
text_dict (
Dict
)style_data
- Return type
- Returns
The new PanelListItem object that was added to the control
-
property
FocusedItem
Gets the currently focused item or -1 if none is focused.
- Returns
- Return type
-
GetFirstSelected
(*_)[source] Returns the first selected item, or -1 when none is selected.
- Return type
-
GetFocusedItem
()[source] Gets the currently focused item or -1 if none is focused.
- Returns
- Return type
-
GetItem
(itemIdx, *_)[source] Returns information about the item. See
SetItem()
for more information.- Parameters
itemIdx
-
GetItemPosition
(item)[source] Returns the position of the item, or
-1
if it is not found.- Return type
-
GetNextSelected
(item)[source] Returns subsequent selected items, or -1 when no more are selected.
- Parameters
item
-
GetSelectedItemCount
()[source] Returns the number of selected items in the list control.
- Return type
-
IsEmpty
()[source] Returns true if the control doesn’t currently contain any items.
- Returns
- Return type
-
-
class
PanelListItem
(parent, text_dict, style_data, id=- 1, style=0, name=b'panel', left_padding=32)[source] Bases:
Panel
- Parameters
parent (
PanelListCtrl
) – The PanelListCtrl the item is to go intotext_dict (
Dict
)style_data
id (
int
) – An identifier for the panel. ID_ANY is taken to mean a default. Default-1
.style (
int
) – The window style. See wx.Panel. Default0
.name (
str
) – Window name. Defaultb'panel'
.left_padding (
int
) – the spacing to the left of the text in the control. Default32
.
Methods:
Returns the current background colour of the :class`wx.Panel` class.
Returns whether the
PanelListItem
is selected.OnClick
(_)OnKeyDown
(event)- param event
The wxPython event.
OnRightClick
(_)Refresh
(**kwargs)SelectItem
([select])Select (or deselect) the given item.
SetBackgroundColour
(colour)Set the background colour for the item.
SetSelectedBackgroundColour
(colour)Set the background colour for the item when it is selected.
-
GetCurrentBackgroundColour
()[source] Returns the current background colour of the :class`wx.Panel` class.
-
IsSelected
()[source] Returns whether the
PanelListItem
is selected.- Return type