Pyautogui: Press Two Keys at the Same Time

I am using pyautogui to simulate pressing shift and end at the same time - when I type this myself, it highlights all the entries, however when I do it via the code below, it just moves to the end file - not highlighting every component, so it seems like shift isn't being pressed. Was wondering if anyone had any ideas?

pyautogui.keyDown('shift')
pyautogui.keyDown('end')
pyautogui.keyUp('end')
pyautogui.keyUp('shift')
1

1 Answer

I know this question is old, but you can get the same result by doing:

pyautogui.hotkey('shift', 'end')
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Elena Rostova

Elena Rostova

Lead Health, Wellness & Medical Journalist

Elena Rostova holds a Master's degree in Public Health Journalism. She covers groundbreaking medical research, holistic wellness trends, mental health awareness, and nutritional science.

Share this article
Twitter Facebook Pinterest