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).

focus()[source]
get(index=None)[source]
Returns

A list of the items contained by this list.

grid(cnf={}, **kw)[source]
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.

pack(cnf={}, **kw)[source]
remove_callback(event, func=None)[source]

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

set(items)[source]

Modify the list of items contained by this list.

unmark(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.

view(item)[source]

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