[Urwid] Resizing windows in urwid: how small is too small?
ian at excess.org
Tue May 8 17:08:06 EDT 2007
James Reeves wrote:
> Hi there,
> I've been playing around with urwid, and it's just about the best
> console UI I've ever run across. However, in the midst of my experiments
> with 0.9.8, I discovered that if one attempts to render a widget on a
> small enough area, an exception is thrown, and the application exits.
> The SVN version fairs better, as it is only when one tries to render a
> widget on a canvas of zero area does an assertion fail. This works well
> enough for single widgets, but problems still occur when one has
> multiple widgets grouped together, such as with a Pile. For instance, if
> I have a Pile of 8 widgets, and then try to resize the window to a
> height of 7, one of those widgets will have to have a height of zero,
> which will cause the program to exit with an assertion failure.
> The solution, I expect, would be to allow canvases of zero area to be
> rendered; or perhaps for container widgets (such as Columns, Piles,
> Frames etc.) not to render any widget if its size has a 0 in the width
> or height column. This is based on the principle that even if the user
> shrinks down the terminal window to such a small size that he cannot
> even see half the widgets, it is better to keep the program running and
> not to show those widgets, then to panic and exit the application.
> Are there any plans to implement such a change already? Or is there any
> reason why this is a really bad idea?
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.
More information about the Urwid