[Urwid] Completely changing listbox contents

Mariusz Kruk Mariusz.Kruk at epsilon.eu.org
Wed Jul 21 08:32:05 EDT 2010


On Wednesday, 21 of July 2010, Dominic LoBue wrote:
> My solution was to create special collapser list objects with variable
> length depending on the attributes expanded, detailed, and label. For
> example if expanded was set to false, then it would report a length of
> 1 and only show the label widget.
> 
> You can see how I did it here:
> http://github.com/dlobue/achelois/blob/master/achelois/read_mode.py

Thank you for your ideas.
After some thought I think I'm gonna use slightly different approach. I'll 
just use widgets that have or have not get_contents() method which would 
return the contents of sub/parent category and just catch "no such attribute" 
exception in case i call it from file, not from directory. That way from the 
listwalker I can just call get_contents from the widget and update the whole 
list with new contents not having to explicitly check what kind of widget I 
have and having to call conditionally. It's not the prettiest solution but for 
now I think it'll have to suffice.

-- 
\------------------------/ 
|  Kruk at epsilon.eu.org   | 
| http://epsilon.eu.org/ | 
/------------------------\ 



More information about the Urwid mailing list