Trying to make image recognition program. Code:
from pyautogui import *
import pyautogui
import time
import keyboard
import random
import win32api, win32con
while 1:
if pyautogui.locateOnScreen('Dassault Falcon 7X.png', confidence=0.8,minSearchTime=5) != None:
print ("I can see it!")
time.sleep(0.5)
else:
print ("Nope nothing there")
For some reason it keeps giving me imagenotfoundexception in red instead of what I want it to say when it doesn’t find anything, “Nope nothing there.”
New contributor
mmewtwosaysbye is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.