11 Sep 2006 22:43
ListBox Won't Scroll Using Keys
Ryan Ross <ryanross <at> ece.ucsb.edu>
2006-09-11 20:43:42 GMT
2006-09-11 20:43:42 GMT
Hi All!
First of all, great library! Interfaces become much prettier much easier than
with curses.
The problem I am having is that my listbox (list of buttons) won't scroll
using the arrow keys. It can definitely get focus though, as I can use the
mouse to select the buttons (and that changes the cursor position). Below are
some relevent portions of code. Each container here is wrapping the one
before it. Also, I've attached a tar.gz of the code + the two sample data
files (hopefully it will go through).
Button Definition:
newbutton = urwid.Button(string.split(line,',')[0],on_animate_button)
newbutton = urwid.AttrWrap(newbutton, 'normtext', 'header')
allow_from_buttons.append(newbutton)
ListBox Definition:
allowfrombox = urwid.ListBox(allow_from_buttons)
Frame Definition:
allowfrom = urwid.Frame(allowfrombox, urwid.AttrWrap(urwid.Text("Allow
From"), 'listheader'))
Column Definition:
listcols = urwid.Columns([('weight',4,allowfrom),
('weight',6,allowservice)],dividechars=1,focus_column=0)
Pile Definition:
complete = urwid.Pile([('fixed', 3, top),listcols],focus_item=1)
(Continue reading)
>
> browse.py doesn't do any stat()'ing of the files in the directory, which
> might account for the speed difference. Urwid does let you do that
> lazily (as files appear on screen instead of all at once), so it will
> seem faster with lots of files.
Maybe, I can do this in lfm too ...
>
> Post any Urwid-specific issues you have to the list and I'll try to help.
Thanks!
Greetings!
Fabian
I'm wrestling with the more general question of how to design an
interface for asking widgets "how big would you like to be?" I hope I
got it right, but if not the pack() function might change slightly in
future versions.
Ian
RSS Feed