This is a Widget Container API for the urwid toolkit. It uses a MVC approach and allows to build trees of widgets. Its design goals are

  • clear separation classes that define, decorate and display trees of widgets
  • representation of trees by local operations on node positions
  • easy to use default implementation for simple trees
  • Collapses are considered decoration

Generally, tree structures are defined by subclassing Tree and overwriting local position movements. For most purposes however, using a SimpleTree will do. The choice to define trees by overwriting local position movements allows to easily define potentially infinite tree structures. See example4 for how to walk local file systems.

Trees of widgets are rendered by TreeBox widgets. These are based on urwids ListBox widget and display trees such that siblings grow vertically and children horizontally. TreeBoxes handle key presses to move in the tree and collapse/expand subtrees if possible.

Indices and tables