Skip to content

Commit a6645ff

Browse files
try keyboard on desktop
1 parent a90e37d commit a6645ff

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

draft_code/keyboard.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
appscreen = lv.screen_active()
2+
appscreen.clean()
3+
4+
password_ta=lv.textarea(appscreen)
5+
password_ta.set_size(200,30)
6+
password_ta.set_one_line(True)
7+
password_ta.align(lv.ALIGN.TOP_MID, 5, 0)
8+
password_ta.set_text("bla")
9+
password_ta.set_placeholder_text("Password")
10+
11+
#password_ta.add_event_cb(password_ta_cb,lv.EVENT.CLICKED,None)
12+
13+
keyboard=lv.keyboard(appscreen)
14+
keyboard.set_size(lv.pct(100),120)
15+
keyboard.align(lv.ALIGN.BOTTOM_LEFT,0,0)
16+
keyboard.set_textarea(password_ta)
17+
18+
#keyboard.add_event_cb(keyboard_cb,lv.EVENT.READY,None)
19+
#keyboard.add_event_cb(keyboard_cb,lv.EVENT.CANCEL,None)
20+
#keyboard.add_event_cb(keyboard_value_changed_cb,lv.EVENT.VALUE_CHANGED,None)
21+
22+
def touch_cb(event):
23+
global canvas
24+
event_code=event.get_code()
25+
print(f"lv_event_t: code={event_code}") # target={event.get_target()}, user_data={event.get_user_data()}, param={event.get_param()}
26+
27+
password_ta.add_event_cb(touch_cb, lv.EVENT.ALL, None)

internal_filesystem/boot_unix.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import lcd_bus
44
import lvgl as lv
55
import sdl_display
6-
import sdl_pointer
6+
77
import mpos.ui
88

99
TFT_HOR_RES=320
@@ -16,8 +16,12 @@
1616
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)
1717
display.init()
1818

19+
import sdl_pointer
1920
mouse = sdl_pointer.SDLPointer()
2021

22+
import sdl_keyboard
23+
keyboard = sdl_keyboard.SDLKeyboard()
24+
2125
# Swipe detection state
2226
start_y = None # Store the starting Y-coordinate of the mouse press
2327
def swipe_read_cb(indev_drv, data):

0 commit comments

Comments
 (0)