Cube 9 个月前
父节点
当前提交
34767d8f69
共有 2 个文件被更改,包括 6 次插入3 次删除
  1. 2
    2
      CARDPUTER CircuitPython/full_display_test.py
  2. 4
    1
      CARDPUTER CircuitPython/keyboard.py

+ 2
- 2
CARDPUTER CircuitPython/full_display_test.py 查看文件

@@ -11,7 +11,7 @@ from keyboard import Keyboard
11 11
 
12 12
 keyb = Keyboard()
13 13
 
14
-text = ""
14
+text = "Press CTRL+D to clear text\n\n"
15 15
 text_area = label.Label(terminalio.FONT, text=text)
16 16
 text_area.x = 10
17 17
 text_area.y = 10
@@ -22,7 +22,7 @@ while True:
22 22
     if key == "BACKSP":
23 23
         text = text[:-1]
24 24
     elif key == "CTRLD":
25
-        text = ""
25
+        text = "Press CTRL+D to clear text\n\n"
26 26
     else:
27 27
         text = text+key
28 28
     text_area.text = text

+ 4
- 1
CARDPUTER CircuitPython/keyboard.py 查看文件

@@ -4,7 +4,10 @@ class Keyboard:
4 4
     def __init__(self):
5 5
         # the number row starts with 3 and ends with the number, e.g. key number 5 is 0x35
6 6
         self.number_row=["0x30","0x31","0x32","0x33","0x34","0x35","0x36","0x37","0x38","0x39"]
7
-        self.chars={"0x21":"!","0x40":"@","0x23":"#","0x24":"$","0x25":"%","0x5e":"^","0x26":"&","0x2a":"*","0x28":"(","0x29":")", "0x3f":"?"}
7
+        self.chars={
8
+            "0x21":"!","0x40":"@","0x23":"#","0x24":"$","0x25":"%","0x5e":"^","0x26":"&","0x2a":"*","0x28":"(","0x29":")", "0x3f":"?",
9
+            "0x27":"'", "0x22":"\"", "0x3a":":", "0x3c":"<", "0x3e":">"
10
+        }
8 11
         self.lowercase={
9 12
             "0x71":"q", "0x77":"w", "0x65":"e", "0x72":"r", "0x74":"t", "0x79":"y", "0x75":"u", "0x69":"i", "0x6f":"o", "0x70":"p",
10 13
             "0x61":"a", "0x73":"s", "0x64":"d", "0x66":"f", "0x67":"g", "0x68":"h", "0x6a":"j", "0x6b":"k", "0x6c":"l",