Package nltk :: Package draw :: Module tree :: Class TreeSegmentWidget
[hide private]
[frames] | no frames]

Class TreeSegmentWidget

source code

  object --+    
           |    
CanvasWidget --+
               |
              TreeSegmentWidget

A canvas widget that displays a single segment of a hierarchical tree. Each TreeSegmentWidget connects a single node widget to a sequence of zero or more subtree widgets. By default, the bottom of the node is connected to the top of each subtree by a single line. However, if the roof attribute is set, then a single triangular "roof" will connect the node to all of its children.

Attributes:

The following attributes may also be added in the near future:

Instance Methods [hide private]
 
__init__(self, canvas, node, subtrees, **attribs)
Create a new canvas widget.
source code
None
__setitem__(self, attr, value)
Set the value of the attribute attr to value.
source code
(any)
__getitem__(self, attr)
Returns: the value of the attribute attr.
source code
 
node(self) source code
 
subtrees(self) source code
 
set_node(self, node)
Set the node to node.
source code
 
replace_child(self, oldchild, newchild)
Replace the child oldchild with newchild.
source code
 
remove_child(self, child) source code
 
insert_child(self, index, child) source code
list of int
_tags(self)
Returns: a list of canvas tags for all graphical elements managed by this canvas widget, not including graphical elements managed by its child widgets.
source code
 
_subtree_top(self, child) source code
 
_node_bottom(self) source code
None
_update(self, child)
Update this canvas widget in response to a change in one of its children.
source code
 
_maintain_order(self, child) source code
 
_maintain_order_vertical(self, child) source code
 
_maintain_order_horizontal(self, child) source code
 
_manage_horizontal(self) source code
 
_manage_vertical(self) source code
None
_manage(self)
Arrange the child widgets of this canvas widget.
source code
string
__repr__(self)
Returns: a string representation of this canvas widget.
source code

Inherited from CanvasWidget: bbox, bind_click, bind_drag, canvas, child_widgets, destroy, height, hidden, hide, manage, move, moveto, parent, show, tags, unbind_click, unbind_drag, update, width

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, canvas, node, subtrees, **attribs)
(Constructor)

source code 

Create a new canvas widget. This constructor should only be called by subclass constructors; and it should be called only after the subclass has constructed all graphical canvas objects and registered all child widgets.

Parameters:
  • canvas - This canvas widget's canvas.
  • parent - This canvas widget's hierarchical parent.
  • attribs - The new canvas widget's attributes.
  • node ()
  • subtrees (list of CanvasWidgetI)
Overrides: CanvasWidget.__init__

__setitem__(self, attr, value)
(Index assignment operator)

source code 

Set the value of the attribute attr to value. See the class documentation for a list of attributes supported by this canvas widget.

Returns: None
Overrides: CanvasWidget.__setitem__
(inherited documentation)

__getitem__(self, attr)
(Indexing operator)

source code 
Returns: (any)
the value of the attribute attr. See the class documentation for a list of attributes supported by this canvas widget.
Overrides: CanvasWidget.__getitem__
(inherited documentation)

_tags(self)

source code 
Returns: list of int
a list of canvas tags for all graphical elements managed by this canvas widget, not including graphical elements managed by its child widgets.
Overrides: CanvasWidget._tags
(inherited documentation)

_update(self, child)

source code 

Update this canvas widget in response to a change in one of its children.

Parameters:
  • child - The child that changed.
Returns: None
Overrides: CanvasWidget._update
(inherited documentation)

_manage(self)

source code 

Arrange the child widgets of this canvas widget. This method is called when the canvas widget is initially created. It is also called if the user calls the manage method on this canvas widget or any of its ancestors.

Returns: None
Overrides: CanvasWidget._manage
(inherited documentation)

__repr__(self)
(Representation operator)

source code 

repr(x)

Returns: string
a string representation of this canvas widget.
Overrides: CanvasWidget.__repr__
(inherited documentation)