Package nltk :: Package draw
[hide private]
[frames] | no frames]

Package draw

source code

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.

Submodules [hide private]
    Graphical Demonstrations
    Widgets

Classes [hide private]
  ColorizedList
An abstract base class for displaying a colorized list of items.
  MutableOptionMenu
    Abstract Widget Superclasses
  CanvasWidget
A collection of graphical elements and bindings used to display a complex object on a Tkinter Canvas.
  AbstractContainerWidget
An abstract class for canvas widgets that contain a single child, such as BoxWidget and OvalWidget.
    Canvas Widgets
  TextWidget
A canvas widget that displays a single string of text.
  SymbolWidget
A canvas widget that displays special symbols, such as the negation sign and the exists operator.
  BoxWidget
A canvas widget that places a box around a child widget.
  OvalWidget
A canvas widget that places a oval around a child widget.
  ParenWidget
A canvas widget that places a pair of parenthases around a child widget.
  BracketWidget
A canvas widget that places a pair of brackets around a child widget.
  SequenceWidget
A canvas widget that keeps a list of canvas widgets in a horizontal line.
  StackWidget
A canvas widget that keeps a list of canvas widgets in a vertical line.
  SpaceWidget
A canvas widget that takes up space but does not display anything.
  ScrollWatcherWidget
A special canvas widget that adjusts its Canvas's scrollregion to always include the bounding boxes of all of its children.
    Tkinter Widgets
  CanvasFrame
A Tkinter frame containing a canvas and scrollbars.
  EntryDialog
A dialog box for entering
  ShowText
A Tkinter window used to display a text.
Functions [hide private]
boolean
in_idle()
Returns: true if this function is run within idle.
source code
Function Details [hide private]

in_idle()

source code 
Returns: boolean
true if this function is run within idle. Tkinter programs that are run in idle should never call Tk.mainloop; so this function should be used to gate all calls to Tk.mainloop.

Warning: This function works by checking sys.stdin. If the user has modified sys.stdin, then it may return incorrect results.