[Urwid] scrolling

Rebecca Breu rebecca at rbreu.de
Wed Jun 28 06:55:28 EDT 2006


Zitat von James Mills <prologic at shortcircuit.net.au>:

> Hi,
>
> How does one accomplish scrolling ?
>
> See attached source.
>

Hi James!

Instead of a Pile widget, I would use a ListBox, they are ideal for scrolling.
You can then set the focus to the newest line, like this:


    #Many lines:
    wlist = [urwid.Text(str(i)) for i in range(1, 40)]

    #widget = urwid.Filler(urwid.Pile(wlist));
    widget = urwid.ListBox(wlist)
    widget.set_focus(len(wlist))


Hope that helps!

Rebecca





More information about the Urwid mailing list