I am trying to write a function that will receive an ASCII character and will generate a keyboard event based on it. KeyboardEvent is the function I'm trying to implement:
from msvcrt import getch
key= ord(getch()) #getting the ASCII character for a key that was pressed
KeyboardEvent(key)
def KeyboardEvent(key):
#code that simulates the key (that the ASCII character represents) being pressed on keyboard
I've tried looking for answers and the closest I've gotten to is this question Generate keyboard events However, the code that the answer suggested is not based on ASCII characters and doesn't meet my needs. Any help would be appreciated. Thank you in advance