[Urwid] How do you use SimpleListWalker?
dom.lobue at gmail.com
Fri Jun 19 11:11:13 EDT 2009
Thanks for clearing that up for me. I've looked through browse.py
several times, but I just get lost every time. I really don't need
anything more complex than the SimpleListWalker or the
PollingListWalker, as I'm not planning on showing anymore more than a
short summary of the conversation. I don't have any plans to expand
the conversation in the index view.
I take it that while SimpleListWalker acts like a regular list, its
supposed to be a list of widgets, correct? Meaning that the data would
be structured from the ListBox on down like so:
urwid.Button(conversation), urwid.Button(conversation) ]))
On Fri, Jun 19, 2009 at 5:46 AM, Ian Ward<ian at excess.org> wrote:
> 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.
> Dominic LoBue wrote:
>> 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
>> Keep up the good work with urwid!
>> Urwid mailing list
>> Urwid at lists.excess.org
> Urwid mailing list
> Urwid at lists.excess.org
More information about the Urwid