Update 'CARDPUTER CircuitPython/projects/text_editor.py'

This commit is contained in:
2025-03-05 12:25:29 +00:00
parent 1fddfb37cc
commit f116dfc4c2

View File

@@ -34,18 +34,25 @@ except OSError:
keyb = Keyboard()
text = "Press CTRL+D to clear text\n"+SD_status+"\n\n"
intro_text = "Press CTRL+D to clear text\n"+SD_status+"\n\n"
intro_text_area = label.Label(terminalio.FONT, text=intro_text, color="C3B")
intro_text_area.x = 10
intro_text_area.y = 10
text = ""
text_area = label.Label(terminalio.FONT, text=text)
text_area.x = 10
text_area.y = 10
board.DISPLAY.root_group = text_area
text_area.x = 0
text_area.y = 40
board.DISPLAY.root_group = intro_text_area
intro_text_area.append(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"
text = ""
else:
## WRAPPING
## calculate wrapping when entering a character