python - Fastest Way to Check if Image is Onscreen Using pyautogui -


i have following code:

b_counter = false  while (b_counter == false):     if (pyautogui.locateonscreen('editcheck.png') not none):             pyautogui.click(pyautogui.center(pyautogui.locateonscreen('home.png')))             b_counter = true 

the loop lags when running, 10 seconds after image has loaded. machine pretty fast (i7 16gb ram etc). there way speed loop?

i'm loading webpages "home" buttons not appear immediately. loop occurs after pyautogui has entered in web address load.

found answer question. select region make search feature faster. way, program won't searching through whole screen, specific region.

ex:

    import pyauotgui     pyautogui.locateonscreen('test.png', region = (0,0,400,400)) 

where region = left, top, width, height


Comments

Popular posts from this blog

service - Android MediaPlayer calls onCompletion before it already finished -

javascript - Training Neural Network to play flappy bird with genetic algorithm - Why can't it learn? -

javascript - Create a stacked percentage column -