lvgl: lv_example_chart_6 Attribute error in chart example.
Perform all steps below and tick them with [x]
- [x ] Read the FAQ
- [ x] Check the related part of the Documentation
- [x ] Update lvgl to the latest version
- [ x] Reproduce the issue in a Simulator
Describe the bug
/examples/widgets/chart/lv_example_chart_6.py has an error in it.
Traceback (most recent call last):
File "<stdin>", line 88, in event_cb
AttributeError: no such attribute
line88: ` lv.draw_rect(a, dsc.clip_area, draw_rect_dsc)```
The attribute error is 2 fold.
lv.draw_rect
and also dsc.clip_area
This problem exists in both 8.3 and 9.0. I believe it is a build issue. In the lv_mp.c file for my compiled version draw_rect is present.
there is no clip_area field for lv.obj_draw_part_dsc_t
.
The order of the parameters for lv.draw_rect
is also wrong and the types being passed to it are incorrect as well.
void lv_draw_rect(lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * dsc, const lv_area_t * coords)
I do not believe that clip_area
could actually be used because of the parameters that need to be passed to lv.draw_rect
does not allow for passing 2 lv.area_t objects. Maybe the call is supposed to be lv.draw_rect(dsc.draw_ctx, draw_rect_dsc, a)
Then the only thing that would need to be corrected after that would be the build in order to get lv_draw_rect
exposed to MicroPython
To Reproduce
you have to click on one of the dots on the chart in the example for the error to occur.
Expected behavior
not have the attribute error
I would fix the issue but I am not sure of how to go about doing it because of the need to change the compiled MicroPython used in the simulator.
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 46 (43 by maintainers)
Commits related to this issue
- bugfix: missing quals is writeable Related: https://github.com/lvgl/lvgl/issues/3945#issuecomment-1445159434 — committed to lvgl/lv_binding_micropython by amirgon a year ago
- bugfix: missing quals is writeable Related: https://github.com/lvgl/lvgl/issues/3945#issuecomment-1445159434 — committed to lvgl/lv_binding_micropython by amirgon a year ago
In this case you may wait a little with the merge. I will try to correct the Python equivalent as well.
Ah… It works now.
You are right, I was not on the latest lvgl master. lv_sim_eclipse_sdl also cannot be built with the latest master at the moment. So… things are a little tricky. I now rebuilt lv_micropython using the arch/drivers branch and the latest lvgl master and there the C code of the meter examples has changed. … and that helps! The Python meter examples need quite a few changes but I got the first one to work.
You are right, there is no problem:
So given an object
c
of typedraw_ctx_t
, we can simply call:c.rect(draw_rect_dsc, a)