TreeWidget
is a Python MegaWidget which
displays a tree structure in
a Tkinter text
widget. Each tree node
is displayed in one line, indented according to
its depth. This gives a presentation similar to
a hierarchical content table. The
presentation of internal nodes can be folded (collapsed)
or expanded. Folding removes the node's descendants from
the display, expansion adds children or (optionally)
descendants further down the line.
Icons before the node representation show whether
the node can be collapsed, expanded or is a leave.
The widget provides an update
method
to synchronize the display with a dynamically modified
tree. It tries to keep a node's display state (expanded/collapsed)
unchanged during updates (but may collapse expanded nodes
for some forms of changes, e.g. reordering of children).
The widget tries hard to release internal resources early, allowing it to display dynamic trees associated with scarce resources.
TreeWidget
uses Greg McFarlane's excellent
Python MegaWidget Framework.
TreeWidget
can be used under a Python like license.
See the copyright notice at the start of TreeWidget.py
,
for details.
TreeExplorer
in Doug Hellmann's
PmwContribD package
TreeWidget
and provides nicer symbols. It seems, however, not to support
dynamically changing trees and early resource release.
TreeWidget
class in Guido's IDLE
package
TreeWidget
module some things on Guido's
todo list are done, especially partial and total redisplay
(to support changing trees), keeping track of object ids,
early release of functions implicitely defined for bindings.
My TreeWidget
is implemented as Pmw MegaWidget
and uses a Pmw.ScrolledText as medium for tree display;
Guido only requires plain Tkinter and uses a Canvas
for tree display. His icon management is fancier.
He supports more features in the basic infrastructure
(double clicking opens/closes node, items are editable)
that must be provided by the application in my framework
(if they are needed).
TreeWidget
requires Pmw
and of cause
Python to be installed. It has been tested with Pmw 0.8.0/0.8.1/0.8.3
and Python 1.5.2 but may run with other versions, too.
TreeWidget
version 0.05 can be downloaded
as an 8 kB tgz archive.
fstree.py
.
Start it by python fstree.py folder_to_view
.
Beside the usual folding/unfolding,
<Button-1> applied to the label of an item updates the
corresponding subtree.
disableselection
to disable the selection