Skip to content

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

Open
@amirgon

Description

@amirgon

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions