summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorIan Ward <ian@excess.org>2012-07-22 10:41:11 -0400
committerIan Ward <ian@excess.org>2012-07-22 10:41:11 -0400
commitdf5f10ceeaee65755656a4f2a8155679c2f52fc5 (patch)
treebd6a79576cde7e54e0ccdbf33fa40feb79a888e6 /docs
parent2bfe0563a99062973a30defd96bd0bec52b89bf2 (diff)
downloadurwid-df5f10ceeaee65755656a4f2a8155679c2f52fc5.tar.gz
tutorial: update listbox scrolling example
--HG-- branch : feature-sphinx
Diffstat (limited to 'docs')
-rw-r--r--docs/tutorial/index.rst1
-rw-r--r--docs/tutorial/lbscr.py18
-rw-r--r--docs/tutorial/lbscr.py.xdotool2
-rw-r--r--docs/tutorial/lbscr1.pngbin812 -> 789 bytes
-rw-r--r--docs/tutorial/lbscr2.pngbin715 -> 804 bytes
-rw-r--r--docs/tutorial/lbscr3.pngbin685 -> 709 bytes
-rw-r--r--docs/tutorial/lbscr4.pngbin552 -> 614 bytes
-rw-r--r--docs/tutorial/lbscr5.pngbin587 -> 625 bytes
-rw-r--r--docs/tutorial/lbscr6.pngbin715 -> 614 bytes
-rw-r--r--docs/tutorial/lbscr7.pngbin809 -> 738 bytes
-rw-r--r--docs/tutorial/lbscr8.pngbin922 -> 732 bytes
-rw-r--r--docs/tutorial/lbscr9.pngbin778 -> 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
index ea6ead0..d76d326 100644
--- a/docs/tutorial/lbscr1.png
+++ b/docs/tutorial/lbscr1.png
Binary files differ
diff --git a/docs/tutorial/lbscr2.png b/docs/tutorial/lbscr2.png
index c7740be..2e05b5d 100644
--- a/docs/tutorial/lbscr2.png
+++ b/docs/tutorial/lbscr2.png
Binary files differ
diff --git a/docs/tutorial/lbscr3.png b/docs/tutorial/lbscr3.png
index 2218d59..ba4f218 100644
--- a/docs/tutorial/lbscr3.png
+++ b/docs/tutorial/lbscr3.png
Binary files differ
diff --git a/docs/tutorial/lbscr4.png b/docs/tutorial/lbscr4.png
index 6a2d0fd..a211446 100644
--- a/docs/tutorial/lbscr4.png
+++ b/docs/tutorial/lbscr4.png
Binary files differ
diff --git a/docs/tutorial/lbscr5.png b/docs/tutorial/lbscr5.png
index 960c1f8..8a8d6db 100644
--- a/docs/tutorial/lbscr5.png
+++ b/docs/tutorial/lbscr5.png
Binary files differ
diff --git a/docs/tutorial/lbscr6.png b/docs/tutorial/lbscr6.png
index a33a8dc..a211446 100644
--- a/docs/tutorial/lbscr6.png
+++ b/docs/tutorial/lbscr6.png
Binary files differ
diff --git a/docs/tutorial/lbscr7.png b/docs/tutorial/lbscr7.png
index 2fe9706..53c367a 100644
--- a/docs/tutorial/lbscr7.png
+++ b/docs/tutorial/lbscr7.png
Binary files differ
diff --git a/docs/tutorial/lbscr8.png b/docs/tutorial/lbscr8.png
index 80214f5..631c2aa 100644
--- a/docs/tutorial/lbscr8.png
+++ b/docs/tutorial/lbscr8.png
Binary files differ
diff --git a/docs/tutorial/lbscr9.png b/docs/tutorial/lbscr9.png
index efd2fea..5409cfc 100644
--- a/docs/tutorial/lbscr9.png
+++ b/docs/tutorial/lbscr9.png
Binary files differ