[Urwid] How do you use SimpleListWalker?
Ian Ward
ian at excess.org
Fri Jun 19 08:46:39 EDT 2009
A ListWalker is used by the ListBox class to determine what widgets are
displayed in the ListBox, without the ListBox needing to know how that
list is generated.
SimpleListWalker acts like a regular list, so you can add and remove
items from it and the ListBox will be updated.
PollingListWalker is a class for maintaining backwards compatibility
with old versions of Urwid that would let you pass a list in to the
ListBox constructor. It has to check the list contents each time the
ListBox may be updated, making caching useless. You don't want to use
it for new code.
What you need is your own custom ListWalker class. See the browse.py
example, it has a custom ListWalker that displays a tree view of files
on the filesystem, with the ability to expand and collapse that tree.
Ian
Dominic LoBue wrote:
> Hello,
>
> I'm writing an email reader with urwid, but I'm confused as to how the
> SimpleListWalker class works. Is it just a metaclass that you can
> extend to make writing your own custom listwalker easier, or should
> you be able to use it on its own?
>
> Also, what's the difference between SimpleListWalker and
> PollingListWalker? My application is going to thread emails and the
> index view is going to show conversations (like gmail), with
> conversations with recent activity pushed to the top, so I'm not sure
> which walker is more appropriate, or if its even necessary to bother
> with.
>
> Keep up the good work with urwid!
>
> Dominic
>
>
> _______________________________________________
> Urwid mailing list
> Urwid at lists.excess.org
> http://lists.excess.org/mailman/listinfo/urwid
>
More information about the Urwid
mailing list