first of all i'm a bigginner and i have a problem with Pyautogui .
i create a simple code to find the software logo on desktop then type 'I found it ' ,and if i hide the logo the cod type 'I am unable to found it,the code works good.
but when i add another action ,which is i want the mouse move to the position of the logo . its works good ,but when i hide the logo the mouse still move to the postion ,and still type i found it , but normally the code should show me I am unable to found it.
please heelp me with an correct cod.
my code is:
i create a simple code to find the software logo on desktop then type 'I found it ' ,and if i hide the logo the cod type 'I am unable to found it,the code works good.
but when i add another action ,which is i want the mouse move to the position of the logo . its works good ,but when i hide the logo the mouse still move to the postion ,and still type i found it , but normally the code should show me I am unable to found it.
please heelp me with an correct cod.
my code is:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
import pyautogui import time location = pyautogui.locateOnScreen( 'image.png' , confidence = 0.6 ) while 1 : if location: print ( "I found it " ) time.sleep( 2 ) print (pyautogui.moveTo(location)) else : print ( "I am unable to found it" ) |
nilamo write Jan-27-2021, 05:44 PM:
Added code tags for you.
Added code tags for you.