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:

PanelListCtrl(parent[, id, pos, size, …])

PanelListItem(parent, text_dict, style_data)

type parent

PanelListCtrl

class PanelListCtrl(parent, id=- 1, pos=(- 1, - 1), size=(- 1, - 1), style=524288, name=b'panel', left_padding=32)[source]

Bases: ScrolledWindow

Methods:

AcceptsFocus()

AcceptsFocusFromKeyboard()

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.

DeselectAll()

Deselect all items.

Focus(idx)

Set Focus to the the given item.

GetColumnCount()

Returns the number of columns.

GetFirstSelected(*_)

Returns the first selected item, or -1 when none is selected.

GetFocusedItem()

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.

GetItemCount()

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.

GetSelectedItemCount()

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:

ColumnCount

Returns the number of columns.

FocusedItem

Gets the currently focused item or -1 if none is focused.

ItemCount

Returns the number of items in the list control.

AcceptsFocus()[source]
AcceptsFocusFromKeyboard()[source]
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

PanelListItem

Returns

The new PanelListItem object that was added to the control

Clear()[source]

Removes all items from the control

property ColumnCount

Returns the number of columns.

Return type

int

DeleteItem(item)[source]

Deletes the specified item from the control.

Parameters

item

Return type

bool

Returns

True if the item was removed, False otherwise (usually because the item wasn’t in the control)

DeselectAll()[source]

Deselect all items.

Focus(idx)[source]

Set Focus to the the given item.

Parameters

idx

property FocusedItem

Gets the currently focused item or -1 if none is focused.

Returns

Return type

GetColumnCount()[source]

Returns the number of columns.

GetFirstSelected(*_)[source]

Returns the first selected item, or -1 when none is selected.

Return type

int

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

GetItemBackgroundColour(item)[source]

Returns the colour for this item.

Return type

Colour

GetItemCount()[source]

Returns the number of items in the list control.

Return type

int

GetItemPosition(item)[source]

Returns the position of the item, or -1 if it is not found.

Return type

int

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

int

IsEmpty()[source]

Returns true if the control doesn’t currently contain any items.

Returns

Return type

IsSelected(idx)[source]

Returns :py:obj:`True` if the item is selected.

Parameters

idx

property ItemCount

Returns the number of items in the list control.

Return type

int

RefreshItem(item)[source]

Redraws the given item.

Parameters

item

RefreshItems(itemFrom, itemTo)[source]

Redraws the items between itemFrom and itemTo.

Parameters
  • itemFrom

  • itemTo

Select(idx, on=1)[source]

Selects/deselects an item.

Parameters
  • idx

  • on (int) – Default 1.

SetSelection(idx)[source]

Set the current selection to the item at the given index.

Parameters

idx (int) – index of the item to select.

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 into

  • text_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. Default 0.

  • name (str) – Window name. Default b'panel'.

  • left_padding (int) – the spacing to the left of the text in the control. Default 32.

Methods:

DeselectItem()

GetBackgroundColour()

GetContents()

GetCurrentBackgroundColour()

Returns the current background colour of the :class`wx.Panel` class.

IsSelected()

Returns whether the PanelListItem is selected.

OnClick(_)

OnDoubleClick(_)

OnKeyDown(event)

param event

The wxPython event.

OnMiddleClick(_)

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.

DeselectItem()[source]
GetBackgroundColour()[source]
GetContents()[source]
GetCurrentBackgroundColour()[source]

Returns the current background colour of the :class`wx.Panel` class.

IsSelected()[source]

Returns whether the PanelListItem is selected.

Return type

bool

OnClick(_)[source]
OnDoubleClick(_)[source]
OnKeyDown(event)[source]
Parameters

event – The wxPython event.

OnMiddleClick(_)[source]
OnRightClick(_)[source]
Refresh(**kwargs)[source]
SelectItem(select=True)[source]

Select (or deselect) the given item.

Parameters

select (bool) – If False the item is deselected. Default True.

SetBackgroundColour(colour)[source]

Set the background colour for the item.

Parameters

colour

SetSelectedBackgroundColour(colour)[source]

Set the background colour for the item when it is selected.

Parameters

colour