Package nltk_lite :: Package draw :: Class ColorizedList
[show private | hide private]
[frames | no frames]

Type ColorizedList

object --+
         |
        ColorizedList

Known Subclasses:
EdgeList, ProductionList

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

Note: Typically, you will want to register a callback for 'select' that calls mark on the given item.

Method Summary
  __init__(self, parent, items, **options)
Construct a new list.
  add_callback(self, event, func)
Register a callback function with the list.
  focus(self)
  get(self, index)
Return a list of the items contained by this list.
  grid(self, cnf, **kw)
  mark(self, item)
Highlight the given item.
  markonly(self, item)
Remove any current highlighting, and mark the given item.
  pack(self, cnf, **kw)
  remove_callback(self, event, func)
Deregister a callback function.
  set(self, items)
Modify the list of items contained by this list.
  unmark(self, item)
Remove highlighting from the given item; or from every item, if no item is given.
  view(self, item)
Adjust the view such that the given item is visible.
  _buttonpress(self, event)
  _fire_callback(self, event, itemnum)
  _init_colortags(self, textwidget, options)
Set up any colortags that will be used by this colorized list.
  _init_itemframe(self, options)
  _item_repr(self, item)
Return a list of (text, colortag) tuples that make up the colorized representation of the item.
  _keypress(self, event)
Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Method Details

__init__(self, parent, items=[], **options)
(Constructor)

Construct a new list.
Parameters:
parent - The Tk widget that contains the colorized list
items - The initial contents of the colorized list.
options -
Overrides:
__builtin__.object.__init__

add_callback(self, event, func)

Register a callback function with the list. This function will be called whenever the given event occurs.
Parameters:
event - The event that will trigger the callback function. Valid events are: click1, click2, click3, space, return, select, up, down, next, prior, move
func - The 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).

get(self, index=None)

Returns:
A list of the items contained by this list.

mark(self, item)

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

markonly(self, item)

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

remove_callback(self, event, func=None)

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

set(self, items)

Modify the list of items contained by this list.

unmark(self, item=None)

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

view(self, item)

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

_init_colortags(self, textwidget, options)

Set up any colortags that will be used by this colorized list. E.g.:
>>> textwidget.tag_config('terminal', foreground='black')

_item_repr(self, item)

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.

Generated by Epydoc 2.1 on Tue Sep 5 09:37:21 2006 http://epydoc.sf.net