Search code examples
pythonclickauto

Auto clicker for games


Hello so I want to create a script in python that accepts my game instantly. I do the following using IDLE SHELL:

import pyautogui

import os

**butt=pyautogui.locateCenterOnScreen('C:\\Users\\dariu\\Desktop\\autoclicker\\button.png', minSearchTime=2000)**

pyautogui.moveTo(butt) 

pyautogui.click(butt)

pyautogui.click(butt)

After the bold line of code I got the following error:

Traceback (most recent call last):
  File "<pyshell#6>", line 1, in <module>
    butt=pyautogui.locateCenterOnScreen('C:\\Users\\dariu\\Desktop\\autoclicker\\button.png', minSearchTime=2000)
  File "C:\Users\dariu\AppData\Local\Programs\Python\Python310\lib\site-packages\pyautogui\__init__.py", line 175, in wrapper
    return wrappedFunction(*args, **kwargs)
  File "C:\Users\dariu\AppData\Local\Programs\Python\Python310\lib\site-packages\pyautogui\__init__.py", line 207, in locateCenterOnScreen
    return pyscreeze.locateCenterOnScreen(*args, **kwargs)
  File "C:\Users\dariu\AppData\Local\Programs\Python\Python310\lib\site-packages\pyscreeze\__init__.py", line 413, in locateCenterOnScreen
    coords = locateOnScreen(image, **kwargs)
  File "C:\Users\dariu\AppData\Local\Programs\Python\Python310\lib\site-packages\pyscreeze\__init__.py", line 372, in locateOnScreen
    screenshotIm = screenshot(region=None) # the locateAll() function must handle cropping to return accurate coordinates, so don't pass a region here.
  File "C:\Users\dariu\AppData\Local\Programs\Python\Python310\lib\site-packages\pyscreeze\__init__.py", line 144, in wrapper
    raise PyScreezeException('The Pillow package is required to use this function.')
pyscreeze.PyScreezeException: The Pillow package is required to use this function.


Solution

  • Looks like Pillow package is required in order to use one of your packages. Check the last line of the Traceback error

    import this before the bold line: link to Pillow PyPI