[Urwid] Changing Padding(width) default value in 1.1

Uri Goren goren.uri at gmail.com
Thu Jul 12 04:36:35 EDT 2012


Ian Ward <ian <at> excess.org> writes:

> 
> In 0.9.9 after adding the more user-friendly parameters left and right
> to the Padding constructor, I also quietly gave the align and width
> parameters default values of 'left' and 'pack'.
> 
> The latter has now caused problems for a number of people.  A really
> common request is to just want to indent something by a few characters,
> but to do that safely you need to do something like:
> 
>     urwid.Padding(my_thing, width=('relative', 100), left=4)
> 
> My preference is to change the width default to ('relative', 100) for
> the next Urwid release, and add a warning for people using Padding
> without specifying a width in the next bugfix release 1.0.2.
> 
> The 'pack' option only really works for Text widgets, and only makes a
> difference to the appearance (as compared to ('relative', 100) when the
> text alignment is different than than the padding alignment).  So I
> believe the potential for breaking existing programs is low.
> 
> If this change will cause problems for you please speak up, maybe there
> is some other option that won't break otherwise working code built for
> 0.9.9/1.0
> 
> Ian
> 

This change would be great.

I just moved from 0.9.8 to 1.0.1 and my indented input box worked horribly (e.g. 
first character not shown unless I scroll left).
I was going to ask about it here, and saw this, which solves the problem 
perfectly.
I think it should definitely be the default. If I use urwid.Padding(my_thing, 
left=4), I want my_thing to behave just as if it wasn't padded, except that its 
width is 4 chars less.

Thanks.





More information about the Urwid mailing list