#!/usr/bin/env python3 from kb import write_str from kb import write_special from time import sleep from getch import _Getch get = _Getch(); while True: input_key = get() print(input_key + ": " + str(ord(input_key))) #if input_key == "?": # break if ord(input_key) == 127: write_special("BACKSPACE_DELETE") continue if ord(input_key) == 9: write_special("TAB") continue if ord(input_key) == 27: print("Special key detected!") key = [x for x in "ABCDE7890134~2"] input_key = get() #print(ord(input_key)) if ord(input_key) == 27: break if input_key == "[": again = False input_key = get() if input_key != "[": again = True input_key = get() # print(input_key) num = key.index(input_key) + 1 if num == 13: # del print("pressing DEL") write_special("DELETE") continue if num == 14: print("pressing prtscr / sysrq") write_special("PRINT_SCREEN") get() continue print("pressing F" + str(num)) write_special("F" + str(num)) if again: get() #if int(input_key) > 0 and int(input_key) <= 9: # write_special("F" + input_key) #if input_key == "0": # write_special("F10") #if input_key == "-": # write_special("F11") #if input_key == "=": # write_special("F12") #if ord(input_key) == 27: # break write_str(input_key)