acid-drop

- Hacking the planet from a LilyGo T-Deck using custom firmware
git clone git://git.acid.vegas/acid-drop.git
Log | Files | Refs | Archive | README | LICENSE

lv_example_keyboard_1.py (779B)

      1 def 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
     13 kb = lv.keyboard(lv.scr_act())
     14 
     15 # Create a text area. The keyboard will write here
     16 ta = lv.textarea(lv.scr_act())
     17 ta.set_width(200)
     18 ta.align(lv.ALIGN.TOP_LEFT, 10, 10)
     19 ta.add_event_cb(lambda e: ta_event_cb(e,kb), lv.EVENT.ALL, None)
     20 ta.set_placeholder_text("Hello")
     21 
     22 ta = lv.textarea(lv.scr_act())
     23 ta.set_width(200)
     24 ta.align(lv.ALIGN.TOP_RIGHT, -10, 10)
     25 ta.add_event_cb(lambda e: ta_event_cb(e,kb), lv.EVENT.ALL, None)
     26 
     27 kb.set_textarea(ta)
     28