I
I
Ilya Andreev2020-11-03 16:31:47
Python
Ilya Andreev, 2020-11-03 16:31:47

Instead of code execution details, it writes Process finished with exit code 0. What should I do?

5fa15b432bac1348794374.png

In videos on YouTube, when executing the pyautogui.locateCenterOnScreen () command in brackets, it gives the coordinates of the point, but I just have information that the program has been completed and that's it. At the same time, no actions are performed, the program does not look for that part of the screenshot that I indicate to it. How is this problem solved?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
o5a, 2020-11-03
@hippocat

For something to exist, you need to not just call functions, but store the result they return somewhere.

btn1 = pyautogui.locateOnScreen("...")
btn1_center = pyautogui.center(btn1)
pyautogui.click(*btn1_center)

# насколько понимаю, можно напрямую кликнуть там, где найдет иконку
pyautogui.click("my_icon.jpg")

D
Denis, 2020-11-03
@fifty59nine

Try wrapping pyautogui.locateCenterOnScreen() in print():

print(pyautogui.locateCenterOnScreen("C:\prog\screenshots\icon.png"))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question