Answer the question
In order to leave comments, you need to log in
Wrote a code with a loop and operators, but gives a syntax error?
Here is the code:
import pyautogui
import time
time.sleep(5)
while True:
if cords = pyautogui.locateCenterOnScreen('join_button.png')
else:
pyautogui.Click(cords)
Answer the question
In order to leave comments, you need to log in
cords = pyautogui.locateCenterOnScreen('1.png') # если объект виден, то получаем координаты x,y
if cords: # если видно, то...
print('найдено')
else: # иначе...
print('не найдено')
if not cord: #если нет объекта на экране
pyautogui.click(cords)
It even shows you with an arrow where the error is, is it really so difficult to look at the error and correct it and not go to the forum (== for comparison, = for assignment)
Or like this:
while True:
if not cords := pyautogui.locateCenterOnScreen('1.png'):
pyautogui.Click(cords)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question