Hi @imliubo!
There is a bug here, but it’s in LVGL API itself.
lv_list_get_btn_text
is defined like this:
This definition violates the convention for a member function.
The Micropython bindings expect to find list object as the first argument of any lv_list_*
function. However, in this case a btn
is received instead of a list.
A correct version of this function would be something like:
const char * lv_btn_get_text(const lv_obj_t * btn);
because this is really a member function of btn
, not of list
.
@embeddedt / @kisvegabor - would you consider moving this function to btn
class? Is there any reason it’s part of lv_list_*
namespace?
There may be other cases like this in lvgl, here is a related one.
Anyway, for v6 and v7 it’s not possible to change this due to API backward compatibility.
Instead, you can tell Micropython to cast the btn
object to list
manually with the __cast__
function, like this:
lv.list.__cast__(obj).get_btn_text()
I’ve tested this example on both the simulator and on ESP32