nltk.draw.ProductionList

class nltk.draw.ProductionList[source]

Bases: ColorizedList

ARROW = 'Þ'
__init__(parent, items=[], **options)

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)

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()
get(index=None)
Returns

A list of the items contained by this list.

grid(cnf={}, **kw)
mark(item)

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

markonly(item)

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

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

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

set(items)

Modify the list of items contained by this list.

unmark(item=None)

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)

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