1def ta_event_cb(e,kb):
2    code = e.get_code()
3    ta = e.get_target()
4    if code == lv.EVENT.FOCUSED:
5        kb.set_textarea(ta)
6        kb.clear_flag(lv.obj.FLAG.HIDDEN)
7
8    if code == lv.EVENT.DEFOCUSED:
9        kb.set_textarea(None)
10        kb.add_flag(lv.obj.FLAG.HIDDEN)
11
12# Create a keyboard to use it with one of the text areas
13kb = lv.keyboard(lv.scr_act())
14
15# Create a text area. The keyboard will write here
16ta = lv.textarea(lv.scr_act())
17ta.set_width(200)
18ta.align(lv.ALIGN.TOP_LEFT, 10, 10)
19ta.add_event_cb(lambda e: ta_event_cb(e,kb), lv.EVENT.ALL, None)
20ta.set_placeholder_text("Hello")
21
22ta = lv.textarea(lv.scr_act())
23ta.set_width(200)
24ta.align(lv.ALIGN.TOP_RIGHT, -10, 10)
25ta.add_event_cb(lambda e: ta_event_cb(e,kb), lv.EVENT.ALL, None)
26
27kb.set_textarea(ta)
28
29