try keyboard on desktop

This commit is contained in:
Thomas Farstrike
2025-05-15 14:30:15 +02:00
parent a90e37d46a
commit a6645ffcbf
2 changed files with 32 additions and 1 deletions
+27
View File
@@ -0,0 +1,27 @@
appscreen = lv.screen_active()
appscreen.clean()
password_ta=lv.textarea(appscreen)
password_ta.set_size(200,30)
password_ta.set_one_line(True)
password_ta.align(lv.ALIGN.TOP_MID, 5, 0)
password_ta.set_text("bla")
password_ta.set_placeholder_text("Password")
#password_ta.add_event_cb(password_ta_cb,lv.EVENT.CLICKED,None)
keyboard=lv.keyboard(appscreen)
keyboard.set_size(lv.pct(100),120)
keyboard.align(lv.ALIGN.BOTTOM_LEFT,0,0)
keyboard.set_textarea(password_ta)
#keyboard.add_event_cb(keyboard_cb,lv.EVENT.READY,None)
#keyboard.add_event_cb(keyboard_cb,lv.EVENT.CANCEL,None)
#keyboard.add_event_cb(keyboard_value_changed_cb,lv.EVENT.VALUE_CHANGED,None)
def touch_cb(event):
global canvas
event_code=event.get_code()
print(f"lv_event_t: code={event_code}") # target={event.get_target()}, user_data={event.get_user_data()}, param={event.get_param()}
password_ta.add_event_cb(touch_cb, lv.EVENT.ALL, None)
+5 -1
View File
@@ -3,7 +3,7 @@
import lcd_bus
import lvgl as lv
import sdl_display
import sdl_pointer
import mpos.ui
TFT_HOR_RES=320
@@ -16,8 +16,12 @@ buf1 = bus.allocate_framebuffer(TFT_HOR_RES * TFT_VER_RES * 2, 0)
display = sdl_display.SDLDisplay(data_bus=bus,display_width=TFT_HOR_RES,display_height=TFT_VER_RES,frame_buffer1=buf1,color_space=lv.COLOR_FORMAT.RGB565)
display.init()
import sdl_pointer
mouse = sdl_pointer.SDLPointer()
import sdl_keyboard
keyboard = sdl_keyboard.SDLKeyboard()
# Swipe detection state
start_y = None # Store the starting Y-coordinate of the mouse press
def swipe_read_cb(indev_drv, data):