Browse Source

Update 'CARDPUTER CircuitPython/projects/text_editor.py'

cube 9 months ago
parent
commit
f116dfc4c2
1 changed files with 12 additions and 5 deletions
  1. 12
    5
      CARDPUTER CircuitPython/projects/text_editor.py

CARDPUTER CircuitPython/text_editor.py → CARDPUTER CircuitPython/projects/text_editor.py View File

34
 
34
 
35
 keyb = Keyboard()
35
 keyb = Keyboard()
36
 
36
 
37
-text = "Press CTRL+D to clear text\n"+SD_status+"\n\n"
37
+intro_text = "Press CTRL+D to clear text\n"+SD_status+"\n\n"
38
+intro_text_area = label.Label(terminalio.FONT, text=intro_text, color="C3B")
39
+intro_text_area.x = 10
40
+intro_text_area.y = 10
41
+
42
+text = ""
38
 text_area = label.Label(terminalio.FONT, text=text)
43
 text_area = label.Label(terminalio.FONT, text=text)
39
-text_area.x = 10
40
-text_area.y = 10
41
-board.DISPLAY.root_group = text_area
44
+text_area.x = 0
45
+text_area.y = 40
46
+
47
+board.DISPLAY.root_group = intro_text_area
48
+intro_text_area.append(text_area)
42
 
49
 
43
 while True:
50
 while True:
44
     key = keyb.scan()
51
     key = keyb.scan()
45
     if key == "BACKSP":
52
     if key == "BACKSP":
46
         text = text[:-1] 
53
         text = text[:-1] 
47
     elif key == "CTRLD":
54
     elif key == "CTRLD":
48
-        text = "Press CTRL+D to clear text\n\n"
55
+        text = ""
49
     else:
56
     else:
50
         ## WRAPPING
57
         ## WRAPPING
51
         ## calculate wrapping when entering a character 
58
         ## calculate wrapping when entering a character