surafu
Hectopat
- Katılım
- 31 Ağustos 2019
- Mesajlar
- 1.013
- Çözümler
- 4
kodlarımda bir sorun var 1 inci butona basınca program donuyor ve yanıt vermiyor.
import tkinter as tk
import loguru
import pyautogui
import time
def button1_callback():
max_attempts = 99
attempts = 0
tamam_found = False
time.sleep(5)
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("200x100")
button1 = tk.Button(root, text="Buton 1", command=button1_callback)
button1.pack(pady=10)
button2 = tk.Button(root, text="Buton 2", command=button2_callback)
button2.pack(pady=10)
root.mainloop()
import loguru
import pyautogui
import time
def button1_callback():
max_attempts = 99
attempts = 0
tamam_found = False
time.sleep(5)
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("200x100")
button1 = tk.Button(root, text="Buton 1", command=button1_callback)
button1.pack(pady=10)
button2 = tk.Button(root, text="Buton 2", command=button2_callback)
button2.pack(pady=10)
root.mainloop()