improove
This commit is contained in:
@@ -11,7 +11,7 @@ from keyboard import Keyboard
|
||||
|
||||
keyb = Keyboard()
|
||||
|
||||
text = ""
|
||||
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
|
||||
@@ -22,7 +22,7 @@ while True:
|
||||
if key == "BACKSP":
|
||||
text = text[:-1]
|
||||
elif key == "CTRLD":
|
||||
text = ""
|
||||
text = "Press CTRL+D to clear text\n\n"
|
||||
else:
|
||||
text = text+key
|
||||
text_area.text = text
|
||||
|
||||
@@ -4,7 +4,10 @@ class Keyboard:
|
||||
def __init__(self):
|
||||
# the number row starts with 3 and ends with the number, e.g. key number 5 is 0x35
|
||||
self.number_row=["0x30","0x31","0x32","0x33","0x34","0x35","0x36","0x37","0x38","0x39"]
|
||||
self.chars={"0x21":"!","0x40":"@","0x23":"#","0x24":"$","0x25":"%","0x5e":"^","0x26":"&","0x2a":"*","0x28":"(","0x29":")", "0x3f":"?"}
|
||||
self.chars={
|
||||
"0x21":"!","0x40":"@","0x23":"#","0x24":"$","0x25":"%","0x5e":"^","0x26":"&","0x2a":"*","0x28":"(","0x29":")", "0x3f":"?",
|
||||
"0x27":"'", "0x22":"\"", "0x3a":":", "0x3c":"<", "0x3e":">"
|
||||
}
|
||||
self.lowercase={
|
||||
"0x71":"q", "0x77":"w", "0x65":"e", "0x72":"r", "0x74":"t", "0x79":"y", "0x75":"u", "0x69":"i", "0x6f":"o", "0x70":"p",
|
||||
"0x61":"a", "0x73":"s", "0x64":"d", "0x66":"f", "0x67":"g", "0x68":"h", "0x6a":"j", "0x6b":"k", "0x6c":"l",
|
||||
|
||||
Reference in New Issue
Block a user