editable_listbox

A Python implementation of wx.EditableListBox, a ListBox with editable items.

Available in two flavours:

  • Vanilla, that accepts any string value; and

  • Numerical, that only accepts numerical values.

    Those could be str, int, float or decimal.Decimal, but decimal.Decimal is used internally and is the type that will be returned.

Classes:

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

list control with auto-resizable column:

EditableListBox(parent[, id, label, pos, …])

This class provides a composite control that lets the user easily enter and edit a list of strings.

EditableNumericalListBox(parent[, id, …])

type parent

Window

class CleverListCtrl(parent, id=-1, pos=(-1, -1), size=(-1, -1), style=4, validator=<wx.Validator object>, name=b'listCtrl')[source]

Bases: ListCtrl

list control with auto-resizable column:

Parameters
  • parent (Window) – Parent window. Should not be None.

  • id (int) – Default -1.

  • pos (Point) – Default (-1, -1).

  • size (Size) – Default (-1, -1).

  • style (int) – Default 4.

  • validator (Validator) – Default <wx.Validator object at 0x7f21e9c88f10>.

  • name (str) – Default b'listCtrl'.

Methods:

CreateColumns()

OnSize(event)

param event

The wxPython event.

SizeColumns()

CreateColumns()[source]
OnSize(event)[source]
Parameters

event – The wxPython event.

SizeColumns()[source]
class EditableListBox(parent, id=- 1, label='', pos=(- 1, - 1), size=(- 1, - 1), style=1792, name=b'editableListBox')[source]

Bases: Panel

This class provides a composite control that lets the user easily enter and edit a list of strings.

Styles supported:

  • wx.adv.EL_ALLOW_NEW - Allow user to create new items.

  • wx.adv.EL_ALLOW_EDIT - Allow user to edit text in the control.

  • wx.adv.EL_ALLOW_DELETE - Allow user to delete text from the control.

Parameters
  • parent (Window) – Parent window. Should not be None.

  • id (int) – Default -1.

  • label (str) – Default ''.

  • pos (Point) – Default (-1, -1).

  • size (Size) – Default (-1, -1).

  • style (int) – Default 1792.

  • name (str) – Default b'editableListBox'.

Methods:

GetDelButton()

Retrieves a reference to the BitmapButton that is used as the ‘delete’ button in the control.

GetDownButton()

Retrieves a reference to the BitmapButton that is used as the ‘down’ button in the control.

GetEditButton()

Retrieves a reference to the BitmapButton that is used as the ‘edit’ button in the control.

GetListCtrl()

Returns a reference to the actual list control portion of the custom control.

GetNewButton()

Retrieves a reference to the BitmapButton that is used as the ‘new’ button in the control.

GetStrings()

Returns a list of the current contents of the control.

GetUpButton()

Retrieves a reference to the BitmapButton that is used as the ‘up’ button in the control.

OnBeginLabelEdit(event)

param event

The wxPython event.

OnDelItem(_)

OnDownItem(_)

OnEditItem(_)

OnEndLabelEdit(event)

param event

The wxPython event.

OnItemActivated(evt)

OnItemSelected(event)

OnNewItem(event)

param event

The wxPython event.

OnUpItem(_)

SetStrings(strings)

Replaces current contents with given strings.

SetupEditControl()

SwapItems(i1, i2)

type i1

int

on_value_changed(event)

GetDelButton()[source]

Retrieves a reference to the BitmapButton that is used as the ‘delete’ button in the control.

GetDownButton()[source]

Retrieves a reference to the BitmapButton that is used as the ‘down’ button in the control.

GetEditButton()[source]

Retrieves a reference to the BitmapButton that is used as the ‘edit’ button in the control.

GetListCtrl()[source]

Returns a reference to the actual list control portion of the custom control.

Returns

Return type

wx.ListCtrl

GetNewButton()[source]

Retrieves a reference to the BitmapButton that is used as the ‘new’ button in the control.

GetStrings()[source]

Returns a list of the current contents of the control.

Returns

list of strings

Return type

list of str

GetUpButton()[source]

Retrieves a reference to the BitmapButton that is used as the ‘up’ button in the control.

OnBeginLabelEdit(event)[source]
Parameters

event – The wxPython event.

OnDelItem(_)[source]
OnDownItem(_)[source]
OnEditItem(_)[source]
OnEndLabelEdit(event)[source]
Parameters

event – The wxPython event.

OnItemActivated(evt)[source]
OnItemSelected(event)[source]
OnNewItem(event)[source]
Parameters

event – The wxPython event.

OnUpItem(_)[source]
SetStrings(strings)[source]

Replaces current contents with given strings.

Parameters

strings (List[str]) – list of strings.

SetupEditControl()[source]
SwapItems(i1, i2)[source]
Parameters
on_value_changed(event)[source]
class EditableNumericalListBox(parent, id=- 1, label='', decimal_places=- 1, pos=(- 1, - 1), size=(- 1, - 1), style=1792, name=b'editableListBox')[source]

Bases: EditableListBox

Parameters
  • parent (Window) – Parent window. Should not be None.

  • id (int) – Default -1.

  • label (str) – Default ''.

  • pos (Point) – Default (-1, -1).

  • size (Size) – Default (-1, -1).

  • style (int) – Default 1792.

  • name (str) – Default b'editableListBox'.

Methods:

GetDecimalPlaces()

GetStrings()

Returns a list of the current contents of the control.

GetValues()

Returns a list of the current contents of the control.

SetDecimalPlaces(_decimal_places)

SetStrings(strings)

Replaces current contents with given strings.

SetValues(values)

Replaces current contents with given values.

SetupEditControl()

on_value_changed(event)

Attributes:

decimal_places

GetDecimalPlaces()[source]
GetStrings()[source]

Returns a list of the current contents of the control.

Returns

list of strings

Return type

list of str

GetValues()[source]

Returns a list of the current contents of the control.

Returns

Return type

SetDecimalPlaces(_decimal_places)[source]
SetStrings(strings)[source]

Replaces current contents with given strings.

Parameters

strings – list of strings.

SetValues(values)[source]

Replaces current contents with given values.

Parameters

values (Sequence[Union[float, Decimal]]) – list of values

SetupEditControl()[source]
property decimal_places
on_value_changed(event)[source]