-
Notifications
You must be signed in to change notification settings - Fork 18
/
example2.arrows.py
executable file
·29 lines (26 loc) · 1.18 KB
/
example2.arrows.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/python
# Copyright (C) 2013 Patrick Totzke <[email protected]>
# This file is released under the GNU GPL, version 3 or a later revision.
from example1 import construct_example_tree, palette, unhandled_input # example data
from urwidtrees.decoration import ArrowTree # for Decoration
from urwidtrees.widgets import TreeBox
import urwid
if __name__ == "__main__":
# get example tree
stree = construct_example_tree()
# Here, we add some decoration by wrapping the tree using ArrowTree.
atree = ArrowTree(stree,
# customize at will..
# arrow_hbar_char=u'\u2550',
# arrow_vbar_char=u'\u2551',
# arrow_tip_char=u'\u25B7',
# arrow_connector_tchar=u'\u2560',
# arrow_connector_lchar=u'\u255A',
)
# put the into a treebox
treebox = TreeBox(atree)
rootwidget = urwid.AttrMap(treebox, 'body')
#add a text footer
footer = urwid.AttrMap(urwid.Text('Q to quit'), 'focus')
#enclose in a frame
urwid.MainLoop(urwid.Frame(rootwidget, footer=footer), palette, unhandled_input = unhandled_input).run() # go