Last active
January 17, 2020 09:42
-
-
Save amirgon/f1f9e3a448ce089536ba725e8456a19d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import lvgl as lv | |
import SDL | |
w = 800 | |
h = 600 | |
lv.init() | |
SDL.init(w=w,h=h) | |
# Register SDL display driver. | |
disp_buf1 = lv.disp_buf_t() | |
buf1_1 = bytes(480*10) | |
lv.disp_buf_init(disp_buf1,buf1_1, None, len(buf1_1)//4) | |
disp_drv = lv.disp_drv_t() | |
lv.disp_drv_init(disp_drv) | |
disp_drv.buffer = disp_buf1 | |
disp_drv.flush_cb = SDL.monitor_flush | |
disp_drv.hor_res = w | |
disp_drv.ver_res = h | |
lv.disp_drv_register(disp_drv) | |
# Regsiter SDL mouse driver | |
indev_drv = lv.indev_drv_t() | |
lv.indev_drv_init(indev_drv) | |
indev_drv.type = lv.INDEV_TYPE.POINTER; | |
indev_drv.read_cb = SDL.mouse_read; | |
lv.indev_drv_register(indev_drv); | |
# Button with a label | |
scr = lv.obj() | |
btn = lv.btn(scr) | |
btn.align(scr, lv.ALIGN.CENTER, 0, 0) | |
label = lv.label(btn) | |
label.set_text('Hello World!') | |
lv.scr_load(scr) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment