[Urwid] Create pile from list
f.braennstroem at gmx.de
Tue Jun 2 01:02:21 EDT 2009
Ian Ward wrote:
> 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])
Ah, quite simple... this probably works for every widget as long as
there is no mixing between different widgets.
>> 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.
Thanks for the help!
More information about the Urwid