[Urwid] Create pile from list
ian at excess.org
Mon Jun 1 12:01:51 EDT 2009
Fabian Braennstroem wrote:
> 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) ,Text(liste)
> ,Text(liste),Text(liste) ,Edit(liste) ,Text(liste)
> ,Text(liste) ,Text(liste) ,Text(liste)])
> 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.
More information about the Urwid