lv_binding_micropython icon indicating copy to clipboard operation
lv_binding_micropython copied to clipboard

how to use lv_micropython?

Open lbuque opened this issue 9 months ago • 0 comments

I am testing lv_micropython, below is my code, but I found it does not produce any output. What should I do?

import lvgl as lv

lv.init()

def flush_cb(self, disp_drv, area, color_p):
    print("flush_cb")

disp_drv = lv.display_create(320, 240)
disp_drv.set_color_format(lv.COLOR_FORMAT.RGB565)
buf_size = (320 * 10 * 2)
buf1 = bytearray(buf_size)
buf2 = bytearray(buf_size)
disp_drv.set_buffers(buf1, buf2, buf_size, lv.DISPLAY_RENDER_MODE.PARTIAL)
disp_drv.set_flush_cb(flush_cb)


# set default display to screen 0
lv.display_t.set_default(disp_drv)


scr = lv.obj()
btn = lv.button(scr)
btn.align(lv.ALIGN.CENTER, 0, 0)
label = lv.label(btn)
label.set_text('Hello World!')
lv.screen_load(scr)

while True:
    lv.tick_inc(100)

lbuque avatar Mar 26 '25 09:03 lbuque