 |

22.04.2022, 00:23
|
|
Новичок
Регистрация: 23.06.2021
Сообщений: 3
С нами:
2574562
Репутация:
1
|
|
В шапке
Надо чтобы pyautogui нашёл изображение нажал по нему сначала правой кнопкой мыши, потом левой
Код в котором у меня ошибка
Code:
Код:
import pyautogui as pg
import pydirectinput as pd
import time
ax,ay = pg.locateCenterOnScreen('firefox.PNG',confidence=.6)
def function_when_restart():
print(ax,ay)
pd.click(ax,ay)
print('Waiting to return back to the server...')
time.sleep(8)
pd.moveTo(892,531)
print('finding server...')
pd.click()
print('connecting to the server...')
function_when_restart()
Ошибка которую выдает
Error:
Код:
D:\PycharmProjects\pythonProject\firefox\venv\Scripts\python.exe D:/PycharmProjects/pythonProject/firefox/main.py
Traceback (most recent call last):
File "D:\PycharmProjects\pythonProject\firefox\main.py", line 5, in
ax,ay = pg.locateCenterOnScreen('firefox.PNG',confidence=.6)
File "D:\PycharmProjects\pythonProject\firefox\venv\lib\site-packages\pyautogui\__init__.py", line 175, in wrapper
return wrappedFunction(*args, **kwargs)
File "D:\PycharmProjects\pythonProject\firefox\venv\lib\site-packages\pyautogui\__init__.py", line 207, in locateCenterOnScreen
return pyscreeze.locateCenterOnScreen(*args, **kwargs)
File "D:\PycharmProjects\pythonProject\firefox\venv\lib\site-packages\pyscreeze\__init__.py", line 413, in locateCenterOnScreen
coords = locateOnScreen(image, **kwargs)
File "D:\PycharmProjects\pythonProject\firefox\venv\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 "D:\PycharmProjects\pythonProject\firefox\venv\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.
Process finished with exit code 1
|
|
|

22.04.2022, 13:14
|
|
Новичок
Регистрация: 12.06.2018
Сообщений: 23
С нами:
4168789
Репутация:
8
|
|
нужен Pillow - pip install Pillow
|
|
|

22.04.2022, 14:28
|
|
Новичок
Регистрация: 18.04.2019
Сообщений: 11
С нами:
3722451
Репутация:
53
|
|
pip install Pillow ---> import Pillow
|
|
|

21.01.2023, 11:10
|
|
Участник форума
Регистрация: 03.11.2022
Сообщений: 275
С нами:
1857622
Репутация:
33
|
|
Привет, такая же ошибка, если решил = дай знать
|
|
|

24.01.2023, 21:18
|
|
Постоянный
Регистрация: 09.04.2017
Сообщений: 464
С нами:
4786797
Репутация:
98
|
|
Python:
Код:
import
pyautogui
as
pg
import
pydirectinput
as
pd
import
time
ax
,
ay
=
pg
.
locateCenterOnScreen
(
'firefox.PNG'
,
confidence
=
.6
)
def
function_when_restart
(
)
:
print
(
ax
,
ay
)
pd
.
rightClick
(
ax
,
ay
)
pd
.
leftClick
(
ax
,
ay
)
print
(
'Waiting to return back to the server...'
)
time
.
sleep
(
8
)
pd
.
moveTo
(
892
,
531
)
print
(
'finding server...'
)
pd
.
click
(
)
print
(
'connecting to the server...'
)
function_when_restart
(
)
|
|
|
|
 |
|
Здесь присутствуют: 1 (пользователей: 0 , гостей: 1)
|
|
|
|