import tkinter as tk
import loguru
import pyautogui
import time
import threading
attempts = 0
max_attempts = 0
def button1_callback():
print("test")
max_attempts = 99
attempts = 0
tamam_found = False
time.sleep(5)
return True
while attempts < max_attempts and not tamam_found:
pyautogui.click('foto/tikla.png')
time.sleep(15)
#try:
#location = pyautogui.locateOnScreen('foto/tamam.png')
#if location is not None:
#left, top, width, height = location
#tamam_found = True
#pyautogui.click(location)
#time.sleep(3)
#pyautogui.click(x=1074, y=321)
#time.sleep(18)
#pyautogui.click(x=1070, y=321)
#time.sleep(18)
#pyautogui.click(x=1067, y=328)
#time.sleep(18)
#pyautogui.click(x=975, y=223)
#time.sleep(18)
#pyautogui.click(x=524, y=358)
#time.sleep(18)
#pyautogui.click(x=370, y=271)
#time.sleep(3)
#pyautogui.click(x=461, y=281)
#time.sleep(3)
#pyautogui.click(x=556, y=284)
#time.sleep(3)
#pyautogui.click(x=374, y=378)
#time.sleep(3)
#pyautogui.click(x=465, y=378)
#time.sleep(3)
#pyautogui.click(x=786, y=533)
#time.sleep(3)
#pyautogui.click(x=835, y=503)
#time.sleep(18)
#pyautogui.click(x=299, y=593)
#time.sleep(18)
#pyautogui.click(x=294, y=578)
#time.sleep(18)
#pyautogui.click(x=300, y=586)
#time.sleep(18)
#pyautogui.click(x=709, y=589)
#time.sleep(15)
#except pyautogui.ImageNotFoundException:
#pass
attempts += 1
def button2_callback():
root.quit()
root = tk.Tk()
root.geometry("400x200")
s = threading.Thread(target=button1_callback) # button1 callbck
button1 = tk.Button(root, text="Buton 1", command=s.start())
button1.pack(pady=10)
button2 = tk.Button(root, text="Buton 2", command=button2_callback)
button2.pack(pady=10)
root.mainloop()