thx for the pointers. Unfortunately I do want them to be selected individually, so solution 2 it is :) Thanks! /p
On 6 July 2011 14:38, Ian Ward <[email protected]> wrote: > Patrick Totzke wrote on 2011-07-06 05:52: >> Hi agian, >> Here is something I wanted to ask for some time: >> I want to implement something like a "tag cloud", a FlowWidget that is >> a container for Text widgets of different lengths. I had a look at >> GridFlow, >> but that fixes the elements to equal lengths. Would I have to >> implement such a widget myself by replicating GridFlows code, ignoring >> all the >> padding stuff in render? Or is there an easier way by inherriting from >> WidgetContainer, FlowWidget or both? > > You have at least two options: > > 1. use a Text widget, that way you get word wrapping for free. You can > color different tags differently if you like with text markup. If you > need more control over how it's displayed and wrapped write a text > layout class: > > http://excess.org/urwid/wiki/TextLayout > > 2. Build it with Columns, Pile and use the pack() method on the Text > widgets to calculate the size of each tag. This one will be a lot more > work, but might be better if you want to let the pile/coulumns handle > selection and focus changing (if you need that) > > Ian > > _______________________________________________ > Urwid mailing list > [email protected] > http://lists.excess.org/mailman/listinfo/urwid > _______________________________________________ Urwid mailing list [email protected] http://lists.excess.org/mailman/listinfo/urwid
