I have this code but no matter what I change the image to it still won't click on the characters.
import time
import pyautogui
import keyboard
program_running = True
# Get the size of the screen
screen_width, screen_height = pyautogui.size()
# Calculate the center of the screen
center_x = screen_width / 2
center_y = screen_height / 2
def switch_tab():
pyautogui.keyDown("alt")
pyautogui.press("tab")
pyautogui.keyUp("tab")
pyautogui.keyUp("alt")
switch_tab()
time.sleep(0.1)
while program_running:
man_found = pyautogui.locateOnScreen("Images\\Storm_The_House\\man_1.png")
if man_found:
pyautogui.click(man_found)
elif not man_found:
print("no")
if keyboard.is_pressed("esc"):
program_running = False
break
I tried changing it so it checks for differences from the last frame instead but I couldn't figure that out either.