Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
problem with Pyautogui
#2
(Jan-27-2021, 04:25 PM)rachidel07 Wrote:
location = pyautogui.locateOnScreen('image.png', confidence = 0.6)
while 1:
    if location:

You check for the file's location one time, when the script starts. If you hide it after starting the script, it won't "forget" where it is, because you never check for it again. If you want to continuously watch for the object, you need to continuously look for the object. Like this:
while True:
    location = pyautogui.locateOnScreen('image.png', confidence = 0.6)
    if location:
Reply


Messages In This Thread
problem with Pyautogui - by rachidel07 - Jan-27-2021, 04:25 PM
RE: problem with Pyautogui - by nilamo - Jan-27-2021, 05:43 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Pyautogui, İmagesearch, Moving target Beyazx 0 597 Jun-27-2023, 08:47 PM
Last Post: Beyazx
  PyautoGUI- How to use If - Else with pyautogui.locateCenterOnScreen Tiel 3 8,414 Jun-27-2022, 02:00 PM
Last Post: DeaD_EyE
  pyautogui.locateOnScreen producing error dude8074 6 3,868 Apr-17-2022, 05:05 PM
Last Post: bowlofred
  how to take a screnshot by Pyautogui automatically and randomly rachidel07 0 3,567 Feb-03-2021, 01:16 PM
Last Post: rachidel07
  pyautogui with a display emulator? gumby4231 0 2,613 Jul-30-2020, 02:46 PM
Last Post: gumby4231
  pyautogui.screenshot region is not working alexlu 6 6,539 Jun-04-2020, 10:46 AM
Last Post: alexlu
  loop in pyautogui (python automation GUI application) pyprogrammer 0 4,812 Feb-12-2020, 02:52 PM
Last Post: pyprogrammer
  Doesn't work function pyautogui.typewrite() aliyevmiras 1 4,822 Dec-22-2019, 11:35 AM
Last Post: aliyevmiras
  pyautogui while loop Bmart6969 0 6,586 Oct-03-2019, 03:32 PM
Last Post: Bmart6969
  Can't run pyautogui on Mohave veromi22 4 2,958 Sep-30-2019, 12:41 AM
Last Post: veromi22

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020