Created
August 31, 2019 20:08
-
-
Save amirgon/31040c6238a1e7b1994b5acb03054cc1 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
def init_drv(): | |
import SDL | |
SDL.init() | |
# 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 = 480 | |
disp_drv.ver_res = 320 | |
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); | |
import lvgl as lv | |
lv.init() | |
init_drv() | |
scr = lv.obj() | |
btn = lv.btn(scr) | |
lv.scr_load(scr) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment