I am unfamiliar with pynput. I have had good experience with pyautogui. As your script isn't yet advanced, you may consider it. https://pyautogui.readthedocs.io/en/latest/introduction.html