[Urwid] Centering Button Text
at.higginson at gmail.com
Wed Apr 11 12:18:43 EDT 2012
On 10/04/12 14:17, Ian Ward wrote:
> On Tue, Apr 10, 2012 at 6:36 AM, Andrew Higginson
> <at.higginson at gmail.com> wrote:
>> So I am new to urwid and need some help :)
>> I have a set of buttons packed with an urwid.Columns and I would like
>> the text inside each buttons to be centered
>> Currently it looks like this but as you can see, the text is aligned to
>> the left
>> If there is not a method/easy way to achieve this, and it requires some
>> sub-classing, could you give me some pointers on how to do it?
> Button's _label attribute is a Text subclass, so this works:
> my_button._label.align = 'center'
> You could add that to the __init__ of a Button subclass if you like.
Wow, that was easier than I thought :)
More information about the Urwid