| 12345678910111213141516171819202122232425262728 |
- import board
- import terminalio
- from adafruit_display_text import label
- from keyboard import Keyboard
-
- # GUIDE
- # type freely! CTRL+D clears the text.
- # backspace, space, and return function as expected.
- # keys not recognised WILL print "UNKNOWN 0x??", but this is useful for extra key scans
- ######
-
- keyb = Keyboard()
-
- text = ""
- text_area = label.Label(terminalio.FONT, text=text)
- text_area.x = 10
- text_area.y = 10
- board.DISPLAY.root_group = text_area
-
- while True:
- key = keyb.scan()
- if key == "BACKSP":
- text = text[:-1]
- elif key == "CTRLD":
- text = ""
- else:
- text = text+key
- text_area.text = text
|