Question: Here's the code that I'm trying to run:

```
import pyautogui
r=pyautogui.locateOnScreen('C:\Users\David\Desktop\index.png',grayscale=False)
print r

```

Answer: 
I found that if you program a pause of 1 or 2 seconds (using time.sleep), then it is able to locate the image. It also takes time for python to locate the image (my computer took about 5 seconds).
I think that the library pyautogui needs several recognition points. For example, Number seven on calculator:

[![enter image description here](https://i.stack.imgur.com/rSZ5a.png)](https://i.stack.imgur.com/rSZ5a.png)

The number seven on the calculator of windows 10. In this format, I´ve got the location on the screen.
Thank you for your comments