From b9d5fa0e13ee91373e858108e7539a2bf9ae1faf Mon Sep 17 00:00:00 2001 From: Cole Deck Date: Fri, 23 Oct 2020 18:50:17 +0100 Subject: [PATCH] use ESC to quit --- __pycache__/keycodes.cpython-37.pyc | Bin 2092 -> 2092 bytes input.py | 10 +++++++--- keycodes.py | 3 ++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/__pycache__/keycodes.cpython-37.pyc b/__pycache__/keycodes.cpython-37.pyc index 9ac577c5465a3b216fbb1aea3294e9bd4af25797..f67676fc020793a122c3724c4ed4e9ebec3f1e06 100644 GIT binary patch delta 116 zcmZ1@uttE_iIK!l9dca SlYokgCQY_v|G>=1!3Y3hu_4|7 diff --git a/input.py b/input.py index 3e66ce3..debd9f5 100755 --- a/input.py +++ b/input.py @@ -8,8 +8,8 @@ get = _Getch(); while True: input_key = get() print(input_key + ": " + str(ord(input_key))) - if input_key == "?": - break + #if input_key == "?": + # break if ord(input_key) == 127: write_special("BACKSPACE_DELETE") continue @@ -19,7 +19,11 @@ while True: if ord(input_key) == 27: print("Special key detected!") key = [x for x in "ABCDE7890134~2"] - if get() == "[": + input_key = get() + #print(ord(input_key)) + if ord(input_key) == 27: + break + if input_key == "[": again = False input_key = get() if input_key != "[": diff --git a/keycodes.py b/keycodes.py index 6035db3..5c2fa85 100644 --- a/keycodes.py +++ b/keycodes.py @@ -96,5 +96,6 @@ keycodelst["["] = 0x2f keycodelst["-"] = 0x2d keycodelst["]"] = 0x30 keycodelst["."] = 0x37 -keycodelst["\'"] = 0x31 # This exists, but we use keycodelst["4 instead. +#keycodelst["\'"] = 0x31 # This exists, but we use keycodelst["4 instead. keycodelst["`"] = 0x35 +keycodelst["\'"] = 0x34