My guess would be that ESP32 is using an older version of the binding that has this problem, and the relatively newer binding in the simulator has fixed it?
What happens if you add print(obj) before your other print call? What object type gets printed? I see lvgl obj, and things work as I’d expect.
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:
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:
It’s in the lv_list namespace as it only applies to buttons created directly by the list object. A workaround would be to rename the function to lv_list_btn_get_text and have it accept a list object as the first parameter (though it would be ignored).