lv_binding_micropython icon indicating copy to clipboard operation
lv_binding_micropython copied to clipboard

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

Open amirgon opened this issue 2 years ago • 0 comments

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})
]

amirgon avatar Jan 12 '23 21:01 amirgon