class documentation

An abstract base class for displaying a colorized list of items. Subclasses should define:

  • _init_colortags, which sets up Text color tags that will be used by the list.
  • _item_repr, which returns a list of (text,colortag) tuples that make up the colorized representation of the item.
Note
Typically, you will want to register a callback for 'select' that calls mark on the given item.
Method __init__ Construct a new list.
Method add_callback Register a callback function with the list. This function will be called whenever the given event occurs.
Method focus Undocumented
Method get No summary
Method grid Undocumented
Method mark Highlight the given item. :raise ValueError: If item is not contained in the list.
Method markonly Remove any current highlighting, and mark the given item. :raise ValueError: If item is not contained in the list.
Method pack Undocumented
Method remove_callback Deregister a callback function. If func is none, then all callbacks are removed for the given event.
Method set Modify the list of items contained by this list.
Method unmark Remove highlighting from the given item; or from every item, if no item is given. :raise ValueError: If item is not contained in the list. :raise KeyError: If item is not marked.
Method view Adjust the view such that the given item is visible. If the item is already visible, then do nothing.
Method _buttonpress Undocumented
Method _fire_callback Undocumented
Method _init_colortags Set up any colortags that will be used by this colorized list. E.g.:
Method _init_itemframe Undocumented
Method _item_repr Return a list of (text, colortag) tuples that make up the colorized representation of the item. Colorized representations may not span multiple lines. I.e., the text strings returned may not contain newline characters.
Method _keypress Undocumented
Instance Variable _callbacks Undocumented
Instance Variable _itemframe Undocumented
Instance Variable _items Undocumented
Instance Variable _marks Undocumented
Instance Variable _parent Undocumented
Instance Variable _textscroll Undocumented
Instance Variable _textwidget Undocumented
def __init__(self, parent, items=[], **options): (source)

Construct a new list.

Parameters
parentThe Tk widget that contains the colorized list
itemsThe initial contents of the colorized list.
**options
def add_callback(self, event, func): (source)

Register a callback function with the list. This function will be called whenever the given event occurs.

Parameters
eventThe event that will trigger the callback function. Valid events are: click1, click2, click3, space, return, select, up, down, next, prior, move
funcThe function that should be called when the event occurs. func will be called with a single item as its argument. (The item selected or the item moved to).
def focus(self): (source)

Undocumented

def get(self, index=None): (source)
Returns
A list of the items contained by this list.
def grid(self, cnf={}, **kw): (source)

Undocumented

def mark(self, item): (source)

Highlight the given item. :raise ValueError: If item is not contained in the list.

def markonly(self, item): (source)

Remove any current highlighting, and mark the given item. :raise ValueError: If item is not contained in the list.

def pack(self, cnf={}, **kw): (source)

Undocumented

def remove_callback(self, event, func=None): (source)

Deregister a callback function. If func is none, then all callbacks are removed for the given event.

def set(self, items): (source)

Modify the list of items contained by this list.

def unmark(self, item=None): (source)

Remove highlighting from the given item; or from every item, if no item is given. :raise ValueError: If item is not contained in the list. :raise KeyError: If item is not marked.

def view(self, item): (source)

Adjust the view such that the given item is visible. If the item is already visible, then do nothing.

def _buttonpress(self, event): (source)

Undocumented

def _fire_callback(self, event, itemnum): (source)

Undocumented

@abstractmethod
def _init_colortags(self, textwidget, options): (source)

Set up any colortags that will be used by this colorized list. E.g.:

>>> textwidget.tag_config('terminal', foreground='black')
def _init_itemframe(self, options): (source)

Undocumented

@abstractmethod
def _item_repr(self, item): (source)

Return a list of (text, colortag) tuples that make up the colorized representation of the item. Colorized representations may not span multiple lines. I.e., the text strings returned may not contain newline characters.

def _keypress(self, event): (source)

Undocumented

_callbacks: dict = (source)

Undocumented

_itemframe = (source)

Undocumented

Undocumented

_marks: dict = (source)

Undocumented

Undocumented

_textscroll = (source)

Undocumented

_textwidget = (source)

Undocumented