I Have been trying to get PyAutoGUI to click one of the applications at the bottom of my screen using a very simple code. However, whenever I try to run this code I get an error that I believe is from the PyAutoGUI module I am using. The code is:
import pyautogui as pag
pag.click(500, 1100)
The error is:
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.7/site-packages/pyautogui/__init__.py", line 588, in wrapper
returnVal = wrappedFunction(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/pyautogui/__init__.py", line 978, in click
platformModule._multiClick(x, y, button, clicks)
File "/usr/local/lib/python3.7/site-packages/pyautogui/_pyautogui_osx.py", line 516, in _multiClick
core_graphics.CGEventPost(kCGEvent.Tap.value, mouseEvent)
File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/enum.py", line 349, in __getattr__
raise AttributeError(name) from None
AttributeError: Tap
any ideas how to fix this?
Okay so I figured it out. There is another command in the pyautogui module called pyautogui.mouseDown() and pyautogui.mouseUp(). If you uses these commands in sequence instead of pyautogui.click() it should work.
The working code:
import pyautogui as pag
pag.mouseDown(500, 1100, button='left')
pag.mouseUp(500, 1100, button='left')