sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #03340
Re: [Question #161632]: True or False when image is visible
Question #161632 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/161632
RaiMan proposed the following answer:
*** on comment #3:
This is exactly, why I always recommend to use exists() instead of
find() when dealing with decisions (image there or not).
So clearly: use exists() for these purposes!
... and if you have a series of checks, use exists(image, 0), to make it
as fast as possible.
--- so your example (in a generic way):
def myFunc(imagelist):
result = False
for img in imageList:
if exists(img, 0): result = True
return result
usage:
if myFunc((image1, image2, image3)): print "at least one Found"
else: print ("None found")
--- or a version, that tells you, which where found:
def myFunc(imagelist):
result = []
for img in imageList():
if exists(img, 0): result.append(getLastMatch)
else: result.append(None)
return result
usage:
images = (image1, image2, image3)
found = myFunc(images)
if not found: print ("None found")
else:
print ("found the following")
for n in range(len(found)):
if found[n]: print images[n]+" found at: "+str(found[n])
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.