nltk.draw.ProductionList¶
- class nltk.draw.ProductionList[source]¶
Bases:
ColorizedList
- ARROW = 'Þ'¶
- __init__(parent, items=[], **options)[source]¶
Construct a new list.
- Parameters
parent – The Tk widget that contains the colorized list
items – The initial contents of the colorized list.
options –
- add_callback(event, func)[source]¶
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).
- mark(item)[source]¶
Highlight the given item. :raise ValueError: If
item
is not contained in the list.
- markonly(item)[source]¶
Remove any current highlighting, and mark the given item. :raise ValueError: If
item
is not contained in the list.
- remove_callback(event, func=None)[source]¶
Deregister a callback function. If
func
is none, then all callbacks are removed for the given event.