You are right.
But the following would work:
lv.textarea.set_align(spinbox, lv.TEXT_ALIGN.CENTER)
It actually calls the textarea implementation of set_align
instead of the lv.obj
one.
@kisvegabor - We discussed in the past whether Micropython inheritance should follow the new LVGL inheritance model or not, and agreed that the new inheritance model is only an internal thing and we can still inherit everything directly from lv.obj.
But it breaks here because Micropython selects lv_obj_set_align
instead of lv_textarea_set_align
when running spinbox.set_align
, since spinbox
inherits from lv.obj
.
So in current situation we would need to define a new function lv_spinbox_set_align
that calls lv_textarea_set_align
. But really, why doesn’t set_style_text_align
just work for both textarea
and spinbox
instead of adding new versions of “set_align” that change the meaning of lv_obj_set_align
? It’s a little confusing in my opinion.