浏览代码

Update 'CARDPUTER CircuitPython/projects/text_editor.py'

cube 9 个月前
父节点
当前提交
f116dfc4c2
共有 1 个文件被更改,包括 12 次插入5 次删除
  1. 12
    5
      CARDPUTER CircuitPython/projects/text_editor.py

CARDPUTER CircuitPython/text_editor.py → CARDPUTER CircuitPython/projects/text_editor.py 查看文件

@@ -34,18 +34,25 @@ except OSError:
34 34
 
35 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 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 50
 while True:
44 51
     key = keyb.scan()
45 52
     if key == "BACKSP":
46 53
         text = text[:-1] 
47 54
     elif key == "CTRLD":
48
-        text = "Press CTRL+D to clear text\n\n"
55
+        text = ""
49 56
     else:
50 57
         ## WRAPPING
51 58
         ## calculate wrapping when entering a character