Shi Jie Tio
Shi Jie Tio

Reputation: 2529

How to press 2 key parallel by using pyautogui.press()?

I wish to save a file so the keyboard shortcut is 'ctrl'+'s', I try pyautogui.press(['ctrlleft','s']) but it end up it press key simultaneously. So how to make it happen by pressing the keys parrallel so that the save function can achieve.

Upvotes: 0

Views: 2004

Answers (1)

Carson
Carson

Reputation: 8008

the hotkey() can be passed several key strings which will be pressed down in order, and then released in reverse order

pyautogui.hotkey('ctrlleft', 's')

Reference:https://pyautogui.readthedocs.io/en/latest/keyboard.html

Upvotes: 1

Related Questions