Align Text at the center impossible with label.set_width() defined

Hello,

As I want to use long texts in a button widget with a circular scroll, I defined a label.set_width().
Unfortunately, with V8.1 (it worked on 7.1), I’m not able to align text at the center if I define a width for the label, even if I use the “label.align(lv.ALIGN.CENTER,0,0)” command.

:

scr = lv.obj()
btn = lv.btn(scr)
btn.align(lv.ALIGN.CENTER, 0, 0)
btn.set_size(210,40)
label = lv.label(btn)
label.set_width(200)
label.align(lv.ALIGN.CENTER,0,0)
label.set_text('Hello World!')
lv.scr_load(scr)

Is there another way to align the text ?
Thanks

Hi @Patoche5150

Use:

label.set_style_text_align(lv.TEXT_ALIGN.CENTER,0)

This question is not specific to Micropython.
I suggest posting general LVGL questions to HowTo category.

Hi @amirgon,
Thanks for your help.
It seems that it doesn’t solve my problem. I will do more tests and post a new message in the good category if necessary.

Thanks