sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #55424
Re: [Question #691302]: [HowTo] handling findFailed
Question #691302 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/691302
RaiMan posted a new comment:
The solution masuo suggested in comment #3 is the best one.
It gives the chance to evaluate the matches with little effort.
To use findBest() only makes sense, if you have more than one image and
want to find the one with the highest score (e.g. a button, that might
have different states).
If you want to work without handling FindFailed, you have to use
exists().
So in your case, supposing the resulting matches do not matter:
if rightRegion.exists(Pattern("1592064085453.png").similar(0.98)) or rightRegion.exists(Pattern("1592064049381.png").similar(0.98)):
print "on screen"
else:
print "is not there"
if the matches matter:
match1 = rightRegion.findBest(Pattern("1592064085453.png").similar(0.98))
match2 = rightRegion.findBest(Pattern("1592064049381.png").similar(0.98))
if match1 and match2:
print "on screen both"
elif match1:
print "on screen match1"
elif match2:
print "on screen match2"
else:
print "is not there"
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.