Apr-05-2018, 08:01 PM
You found it yourself, it's in your edit. You knew that that's the function that was taking time. Also, very near the top of the profile text you shared, was the
So I looked up the docs for pyautogui, and it says that pixelMatchesColor is the same thing as pixel(), except that it then checks if the color fits within the passed color parameters. So instead of calling pixel() a lot, I juggled things around to call it just once, and check it's output several times.
I don't think there's any special secret for any of that. Maybe it just takes time programming to be able to have halfway right guesses on where you should start looking :p
pixel()
call, with a cumulative time almost equal to the time spent in pixelMatchesColor()
, meaning that pixelMatchesColor wasn't really slow, it was just waiting for pixel() the entire time.So I looked up the docs for pyautogui, and it says that pixelMatchesColor is the same thing as pixel(), except that it then checks if the color fits within the passed color parameters. So instead of calling pixel() a lot, I juggled things around to call it just once, and check it's output several times.
I don't think there's any special secret for any of that. Maybe it just takes time programming to be able to have halfway right guesses on where you should start looking :p