from micropython import const # NOQA _WIDTH = const(480) _HEIGHT = const(320) _BUFFER_SIZE = _WIDTH * _HEIGHT * 3 import lcd_bus # NOQA bus = lcd_bus.SDLBus(flags=0) buf1 = bus.allocate_framebuffer(_BUFFER_SIZE, 0) buf2 = bus.allocate_framebuffer(_BUFFER_SIZE, 0) import lvgl as lv # NOQA import sdl_display # NOQA lv.init() display = sdl_display.SDLDisplay( data_bus=bus, display_width=_WIDTH, display_height=_HEIGHT, frame_buffer1=buf1, frame_buffer2=buf2, color_space=lv.COLOR_FORMAT.RGB888, ) display.init() import sdl_pointer mouse = sdl_pointer.SDLPointer() scrn = lv.screen_active() scrn.set_style_bg_color(lv.color_hex(0x000000), 0) slider = lv.slider(scrn) slider.set_size(300, 25) slider.center() import task_handler # the duration needs to be set to 5 to have a good response from the mouse. # There is a thread that runs that facilitates double buffering. th = task_handler.TaskHandler(duration=5)