Thanks for the reply

Yes I've seen this property of text layouts and couldn't get why it wasn't
propagated to the widget.
For those interested in this hack, I redefined the._configure method of my
widget (the method that sets the layout):
def _configure(self, qtile, bar):
widget.base._TextBox._configure(self, qtile, bar)
self.layout.width = self.length
When adding this to an instance of widget.base._TextBox, it will contain
centered text. Unexpected behaviour if the argument 'width' is not given to
widget.base._Textbox.__init__.

Le mar. 15 sept. 2020 à 20:20, elParaguayo <[email protected]> a
écrit :

> To expand on my previous reply, I think this works because the default
> text alignment for a TextLayout is centred.
>
> See: https://github.com/qtile/qtile/blob/master/libqtile/drawer.py#L45
>
>
> On Tuesday, 15 September 2020 at 16:06:21 UTC+1 elParaguayo wrote:
>
>> I think the easiest way to do this is to set the text layout width to be
>> the same as the widget width and the text is centred automatically.
>>
>> On Monday, 14 September 2020 at 20:42:15 UTC+1 [email protected] wrote:
>>
>>>
>>> Hello !
>>>
>>> I want to use fixed size text widgets, but the text always sticks to the
>>> left. Is there a way to center the text ? (The text changes so I can't set
>>> a fixed padding).
>>>
>>> Thanks for any help
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "qtile-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/qtile-dev/94c9a60d-100c-478c-9698-80702c099a37n%40googlegroups.com
> <https://groups.google.com/d/msgid/qtile-dev/94c9a60d-100c-478c-9698-80702c099a37n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"qtile-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qtile-dev/CAD%2B5tQ%3DwFM699NNwD3Roi2ibA4_%2BDQmD80AR2YkimbLgL21yzw%40mail.gmail.com.

Reply via email to