Works with: Python version +. Works with: afcef.org('enter') # press the Enter key keyDown('shift') # hold down the shift key. The pyautogui module can send virtual keypresses and mouse clicks to Windows , .. PyAutoGUI will automatically simulate holding down the SHIFT key as well. The press() function is really just a wrapper for the keyDown() and keyUp() functions, which simulate pressing a key down and then releasing it up. Seemingly type out text with an arbitrary speed. Since you want it to seemingly be typed out, you probably would like the characters to appear. Rules. General Rules. Posting only assignment/project goal is not allowed. Read posting guidelines. Easily googleable questions are not. I've been working with Python in a Windows environment and I wrote a three, this one is the closest to simulate an actual, physical key press. This code should get you started. ctypes is used heavily. At the bottom, you will see example code. import ctypes LONG = ctypes.c_long DWORD. This demonstrates how to press keys with Python. Using pynput we are able to simulate key presses into any window. This will show you how. Project description. Take full control of your keyboard with this small Python library. Hook global events, register hotkeys, simulate key presses and much more.