Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pyautogui - Need to hold shift and click

How does one hold shift and and click with the mouse using pyautogui?

    pyautogui.hotkey('shift', click(1611, 600))

have tried the line above. But it doesn't work

like image 723
Gabriel Cesar Avatar asked Jan 28 '23 10:01

Gabriel Cesar


1 Answers

The hotkey() function only works with keys. To shift-click, you need code like this:

import pyautogui
pyautogui.keyDown('shift')
pyautogui.click()
pyautogui.keyUp('shift')
like image 136
Al Sweigart Avatar answered Feb 13 '23 05:02

Al Sweigart