module documentation

Tools for graphically displaying and interacting with the objects and processing classes defined by the Toolkit. These tools are primarily intended to help students visualize the objects that they create.

The graphical tools are typically built using "canvas widgets", each of which encapsulates the graphical elements and bindings used to display a complex object on a Tkinter Canvas. For example, NLTK defines canvas widgets for displaying trees and directed graphs, as well as a number of simpler widgets. These canvas widgets make it easier to build new graphical tools and demos. See the class documentation for CanvasWidget for more information.

The nltk.draw module defines the abstract CanvasWidget base class, and a number of simple canvas widgets. The remaining canvas widgets are defined by submodules, such as nltk.draw.tree.

The nltk.draw module also defines CanvasFrame, which encapsulates a Canvas and its scrollbars. It uses a ScrollWatcherWidget to ensure that all canvas widgets contained on its canvas are within the scroll region.

Acknowledgements: Many of the ideas behind the canvas widget system are derived from CLIG, a Tk-based grapher for linguistic data structures. For more information, see the CLIG homepage (http://www.ags.uni-sb.de/~konrad/clig.html).

Class AbstractContainerWidget An abstract class for canvas widgets that contain a single child, such as BoxWidget and OvalWidget. Subclasses must define a constructor, which should create any new graphical elements and then call the ...
Class BoxWidget A canvas widget that places a box around a child widget.
Class BracketWidget A canvas widget that places a pair of brackets around a child widget.
Class CanvasFrame A Tkinter frame containing a canvas and scrollbars. CanvasFrame uses a ScrollWatcherWidget to ensure that all of the canvas widgets contained on its canvas are within its scrollregion. In order for CanvasFrame...
Class CanvasWidget A collection of graphical elements and bindings used to display a complex object on a Tkinter Canvas. A canvas widget is responsible for managing the Canvas tags and callback bindings necessary to display and interact with the object...
Class ColorizedList An abstract base class for displaying a colorized list of items. Subclasses should define:
Class EntryDialog A dialog box for entering
Class MutableOptionMenu No class docstring; 0/6 instance variable, 1/6 method documented
Class OvalWidget A canvas widget that places a oval around a child widget.
Class ParenWidget A canvas widget that places a pair of parenthases around a child widget.
Class ScrollWatcherWidget A special canvas widget that adjusts its Canvas's scrollregion to always include the bounding boxes of all of its children. The scroll-watcher widget will only increase the size of the Canvas's scrollregion; it will never decrease it.
Class SequenceWidget A canvas widget that keeps a list of canvas widgets in a horizontal line.
Class ShowText A Tkinter window used to display a text. ShowText is typically used by graphical tools to display help text, or similar information.
Class SpaceWidget A canvas widget that takes up space but does not display anything. A SpaceWidget can be used to add space between elements. Each space widget is characterized by a width and a height. If you wish to only create horizontal space, then use a height of zero; and if you wish to only create vertical space, use a width of zero.
Class StackWidget A canvas widget that keeps a list of canvas widgets in a vertical line.
Class SymbolWidget A canvas widget that displays special symbols, such as the negation sign and the exists operator. Symbols are specified by name. Currently, the following symbol names are defined: neg, disj, conj, lambda...
Class TextWidget A canvas widget that displays a single string of text.
Function demo A simple demonstration showing how to use canvas widgets.
def demo(): (source) ΒΆ

A simple demonstration showing how to use canvas widgets.