diff options
| author | Ian Ward <ian@excess.org> | 2012-07-22 10:41:11 -0400 |
|---|---|---|
| committer | Ian Ward <ian@excess.org> | 2012-07-22 10:41:11 -0400 |
| commit | df5f10ceeaee65755656a4f2a8155679c2f52fc5 (patch) | |
| tree | bd6a79576cde7e54e0ccdbf33fa40feb79a888e6 /docs | |
| parent | 2bfe0563a99062973a30defd96bd0bec52b89bf2 (diff) | |
| download | urwid-df5f10ceeaee65755656a4f2a8155679c2f52fc5.tar.gz | |
tutorial: update listbox scrolling example
--HG--
branch : feature-sphinx
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/tutorial/index.rst | 1 | ||||
| -rw-r--r-- | docs/tutorial/lbscr.py | 18 | ||||
| -rw-r--r-- | docs/tutorial/lbscr.py.xdotool | 2 | ||||
| -rw-r--r-- | docs/tutorial/lbscr1.png | bin | 812 -> 789 bytes | |||
| -rw-r--r-- | docs/tutorial/lbscr2.png | bin | 715 -> 804 bytes | |||
| -rw-r--r-- | docs/tutorial/lbscr3.png | bin | 685 -> 709 bytes | |||
| -rw-r--r-- | docs/tutorial/lbscr4.png | bin | 552 -> 614 bytes | |||
| -rw-r--r-- | docs/tutorial/lbscr5.png | bin | 587 -> 625 bytes | |||
| -rw-r--r-- | docs/tutorial/lbscr6.png | bin | 715 -> 614 bytes | |||
| -rw-r--r-- | docs/tutorial/lbscr7.png | bin | 809 -> 738 bytes | |||
| -rw-r--r-- | docs/tutorial/lbscr8.png | bin | 922 -> 732 bytes | |||
| -rw-r--r-- | docs/tutorial/lbscr9.png | bin | 778 -> 782 bytes |
12 files changed, 11 insertions, 10 deletions
diff --git a/docs/tutorial/index.rst b/docs/tutorial/index.rst index 6e86eb8..7bf79c6 100644 --- a/docs/tutorial/index.rst +++ b/docs/tutorial/index.rst @@ -326,6 +326,7 @@ its entirety. This behavior can be used to bring more than a single widget into view by using composite widgets to combine a selectable widget with other widgets that should be displayed at the same time. + Dynamic ListBox with ListWalker ------------------------------- diff --git a/docs/tutorial/lbscr.py b/docs/tutorial/lbscr.py index b7af105..9536549 100644 --- a/docs/tutorial/lbscr.py +++ b/docs/tutorial/lbscr.py @@ -1,25 +1,25 @@ import urwid -def show_all_input(input, raw): +def show_all_input(keys, raw): + """make keys pressed visible to the user""" show_key.set_text(u"Pressed: " + u" ".join([ - unicode(i) for i in input])) - return input + unicode(k) for k in keys])) + return keys -def exit_on_cr(input): - if input == 'enter': +def exit_on_cr(key): + if key == 'enter': raise urwid.ExitMainLoop() palette = [('header', 'white', 'black'), ('reveal focus', 'black', 'dark cyan', 'standout'),] +div = urwid.Divider(u"-") content = urwid.SimpleListWalker([ urwid.AttrMap(w, None, 'reveal focus') for w in [ urwid.Text(u"This is a text string that is fairly long"), urwid.Divider(u"-"),] + [ - urwid.Text(u"Short one"), - urwid.Text(u"Another"), - urwid.Divider(u"-"), ] * 10 + [ - urwid.Text(u"What could be after this?"), + urwid.Text(u"Numbers %d" % i) for i in range(40)] + [ + urwid.Divider(u"-"), urwid.Text(u"The end."),]]) listbox = urwid.ListBox(content) show_key = urwid.Text(u"", wrap='clip') diff --git a/docs/tutorial/lbscr.py.xdotool b/docs/tutorial/lbscr.py.xdotool index 2b2e359..9f733dd 100644 --- a/docs/tutorial/lbscr.py.xdotool +++ b/docs/tutorial/lbscr.py.xdotool @@ -3,7 +3,7 @@ key --window $RXVTWINDOWID Down key --window $RXVTWINDOWID Down key --window $RXVTWINDOWID Down key --window $RXVTWINDOWID Up -key --window $RXVTWINDOWID Up +key --window $RXVTWINDOWID Down windowsize --usehints $RXVTWINDOWID 20 9 windowsize --usehints $RXVTWINDOWID 25 7 windowsize --usehints $RXVTWINDOWID 11 13 diff --git a/docs/tutorial/lbscr1.png b/docs/tutorial/lbscr1.png Binary files differindex ea6ead0..d76d326 100644 --- a/docs/tutorial/lbscr1.png +++ b/docs/tutorial/lbscr1.png diff --git a/docs/tutorial/lbscr2.png b/docs/tutorial/lbscr2.png Binary files differindex c7740be..2e05b5d 100644 --- a/docs/tutorial/lbscr2.png +++ b/docs/tutorial/lbscr2.png diff --git a/docs/tutorial/lbscr3.png b/docs/tutorial/lbscr3.png Binary files differindex 2218d59..ba4f218 100644 --- a/docs/tutorial/lbscr3.png +++ b/docs/tutorial/lbscr3.png diff --git a/docs/tutorial/lbscr4.png b/docs/tutorial/lbscr4.png Binary files differindex 6a2d0fd..a211446 100644 --- a/docs/tutorial/lbscr4.png +++ b/docs/tutorial/lbscr4.png diff --git a/docs/tutorial/lbscr5.png b/docs/tutorial/lbscr5.png Binary files differindex 960c1f8..8a8d6db 100644 --- a/docs/tutorial/lbscr5.png +++ b/docs/tutorial/lbscr5.png diff --git a/docs/tutorial/lbscr6.png b/docs/tutorial/lbscr6.png Binary files differindex a33a8dc..a211446 100644 --- a/docs/tutorial/lbscr6.png +++ b/docs/tutorial/lbscr6.png diff --git a/docs/tutorial/lbscr7.png b/docs/tutorial/lbscr7.png Binary files differindex 2fe9706..53c367a 100644 --- a/docs/tutorial/lbscr7.png +++ b/docs/tutorial/lbscr7.png diff --git a/docs/tutorial/lbscr8.png b/docs/tutorial/lbscr8.png Binary files differindex 80214f5..631c2aa 100644 --- a/docs/tutorial/lbscr8.png +++ b/docs/tutorial/lbscr8.png diff --git a/docs/tutorial/lbscr9.png b/docs/tutorial/lbscr9.png Binary files differindex efd2fea..5409cfc 100644 --- a/docs/tutorial/lbscr9.png +++ b/docs/tutorial/lbscr9.png |
