[Urwid] Resizing windows in urwid: how small is too small?
ian at excess.org
Thu May 10 07:48:03 EDT 2007
James Reeves wrote:
> But might I suggest that it would be better to create some "fixed" and
> "weighted" wrapper classes, instead?
> Columns( [fixed(widget1, size = 10), widget2, weighted(widget3,
> weight = 0.5)] )
> This has the advantage of keeping the layout data and the widgets in one
> list, making it easier and safer to update. For instance, instead of
> having to do:
> columns.column_types.append(('weight', 0.6))
> You could instead:
> columns.widget_list.append( weighted(widget4, 0.6) )
> So there's no need to worry about keeping two lists in sync. One could
> also make the weighted and fixed wrappers mostly-transparent proxies to
> the widgets they contain. If you want, I can knock up a quick patch for
> this behaviour for you to have a look at.
I think that's a great idea. Florian Festi mentioned a similar
discomfort with the way Columns and Piles align widgets, but suggested
adding alignment attributes to the widgets as a solution. I like your
approach better because it lends itself more to Urwid's style of
widget-reuse and small, simple widget classes.
I look forward to your patch :-)
More information about the Urwid