Answer the question
In order to leave comments, you need to log in
How can python code be optimized?
there is a python code that uses pyautogui that finds the numbers on the screen:
a = pyautogui.locateOnScreen("img/ef.png", region=(1400, 750, 500, 200), confidence=0.8)
nums = []
nums_dic = {}
conf = 1
numberr = ""
for num in range(0, 11):
if num == 0:
conf = 0.9
if num == 10:
conf = 0.8
if num == 6:
conf = 0.85
if num == 1 or num == 2 or num == 4 or num == 5:
conf = 0.8
elif num == 3:
conf = 0.77
elif num == 8:
conf == 0.85
elif num == 9:
conf = 0.8
for t in find("img/"+str(num)+".png", region=(a[0]+410, a[1], 60, 20), conf=conf):
if num == 1:
sv_pos = t
if num == 10:
nums_dic[t[0]] = "."
else:
nums_dic[t[0]] = num
nums.append(t[0])
nums.sort()
number = ""
for t in nums:
number = number+str(nums_dic[t])
print(number)
Answer the question
In order to leave comments, you need to log in
You missed num==7. In this case conf is set to 1
confs = [.9, .8, .8, .77, .8, .8, .85, 1, .85, .8, .8]
for num, conf in enumerate(confs):
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question