#import lvgl as lv #lv.init() #from ili9XXX import ili9341 #disp = ili9341(dc=21, miso=19, mosi=23, cs=5, clk=18) # Import XPT2046 driver and initalize it #from xpt2046 import xpt2046 #touch = xpt2046(cs=27, cal_x0=242, cal_x1=3300) def ta_event_cb(e,kb): code = e.get_code() ta = e.get_target() if code == lv.EVENT.FOCUSED: kb.set_textarea(ta) kb.clear_flag(lv.obj.FLAG.HIDDEN) if code == lv.EVENT.DEFOCUSED: kb.set_textarea(None) kb.add_flag(lv.obj.FLAG.HIDDEN) # Create a keyboard to use it with one of the text areas kb = lv.keyboard(lv.scr_act()) print('creating keyboard') # Create a text area. The keyboard will write here ta = lv.textarea(lv.scr_act()) ta.set_width(200) ta.align(lv.ALIGN.TOP_RIGHT, -10, 10) ta.add_event_cb(lambda e: ta_event_cb(e,kb), lv.EVENT.ALL, None) kb.set_textarea(ta)# lv.scr_load(lv.scr_act())