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 = "Press CTRL+D to clear text\n\n" 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 = "Press CTRL+D to clear text\n\n" else: text = text+key text_area.text = text