[Urwid] Resizing windows in urwid: how small is too small?
jreeves at monkeyengines.co.uk
Wed May 9 20:07:55 EDT 2007
Ian Ward wrote:
> Hi James,
> There is a debian bug filed against Urwid for very similar issues.
> Someone is running a terminal where its size can actually shrink to
> zero. As you might imagine, that causes problems like what you are
> I am planning to fix this problem in the container widgets as you
> describe. To be more specific, box widgets need to cope with column or
> row sizes of zero (and produce canvases sized that way), flow widgets
> and fixed widgets are unchanged.
> Urwid mailing list
> Urwid at lists.excess.org
Ah, that's definitely good to know! And whilst we're on the subject of
widgets, I was wondering if I might make a suggestion on the subject of
layout control for Columns and Piles? Currently, one initiates them like:
Columns( [('fixed', 10, widget1), widget2, ('weight', 0.5, widget3)] )
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:
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.
More information about the Urwid