1
import pyautogui as pag   

pag.keyDown('e')
pag.click(x=811,y=697)
pag.click(x=1277,y=508)
pag.keyUp('e')

Hi I am trying to press mouse button 2 times while holding the 'e' key

But keyDown('e') works as press('e').

How can I solve this problem?

Emma
  • 27,428
  • 11
  • 44
  • 69

1 Answers1

0

try this:

import pyautogui as pag   

pag.keyDown('e')
pag.mouseDown(x=811,y=697)
pag.mouseUp(x=1277,y=508)
pag.keyUp('e')

reference

H. pap
  • 339
  • 1
  • 10
  • Then maybe this is the answer you are looking for? https://stackoverflow.com/questions/48682388/pyautogui-press-key-for-x-seconds – H. pap Jun 27 '20 at 12:36
  • That code repeat w several times. I want to hold down the key. btw keyDown() works on other computer. I dont know what is different :( – user13819736 Jun 29 '20 at 13:57