[Urwid] just not getting navigation.
Ian Ward
ian at excess.org
Sun Jul 2 20:12:04 EDT 2006
Eric S. Johansson wrote:
> finally had a chance to take a look at the example. I see what I was
> doing wrong but I'm a bit confused about how to handle one case. How do
> you handle the case where you have variable elements in the column? For
> example the green and orange interfaces have the same number of elements
> but the red and aux interfaces change the number of elements in the
> column. the actual number of elements is not known until runtime.
well, the python way of removing elements from a list is:
del mylist[5:9] # delete elements 5, 6, 7, 8
and the python way to insert elements into a list:
mylist[5:5] = [widget1, widget2] # insert 2 elements at position 5
Those should work fine. If you want to get really fancy you can write
your own list walker class that can dynamically choose ListBox content
as it is being displayed. Many of the included example programs
demonstrate this.
More information about the Urwid
mailing list