[Urwid] Create pile from list
Ian Ward
ian at excess.org
Mon Jun 1 12:01:51 EDT 2009
Fabian Braennstroem wrote:
> Hi,
>
> I would like to create a pile from a list of e.g. 'Text' widgets.
> Right now, I am doing something like this:
>
> self.piler=Pile([Button(liste[0]) ,Text(liste[1])
> ,Text(liste[2]),Text(liste[3]) ,Edit(liste[4]) ,Text(liste[5])
> ,Text(liste[6]) ,Text(liste[7]) ,Text(liste[8])])
>
> but in general I have no idea about the length of the list, so a loop
> over every list item would be needed. Does anyone have an idea?
Are you just asking how to make a Text widget for every item in a list?
Pile([Text(x) for x in liste])
> And one more question, I am often using a simple 'print' to 'debug'
> certain variables, but this does not work in background!? Thanks!
The best way of handling debugging at the moment is to use the python
logging module to log to a file. printing will disturb urwid's output.
There is some interesting work going on in this area, however.
Hopefully Andrew will have some code to post soon.
Ian
More information about the Urwid
mailing list