lvgl / lv_binding_micropython

LVGL binding for MicroPython
MIT License
237 stars 156 forks source link

Arrays are converted to lists - cannot update existing arrays on structs #253

Open amirgon opened 1 year ago

amirgon commented 1 year ago

See: https://forum.lvgl.io/t/gradient-is-not-working-with-lv-draw-rect-dsc-t/10612

rect_dsc.bg_grad.stops[0].color = lv.palette_main(lv.PALETTE.RED)
rect_dsc.bg_grad.stops[1].color = lv.palette_main(lv.PALETTE.BLUE)

does not work, because stops is converted to list and does not update the original array upon update.

A workaround can be to the the whole array:

rect_dsc.bg_grad.stops = [
    lv.gradient_stop_t({'color': lv.palette_main(lv.PALETTE.RED)}),
    lv.gradient_stop_t({'color': lv.palette_main(lv.PALETTE.BLUE), 'frac':0xff})
]