← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #252512]: How to use regions properly

 

Question #252512 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/252512

RaiMan posted a new comment:
@Eugene
your solution is principally ok, but very time consuming caused by the unnecessary waiting for not existing images in this case.

so at least this way:
imagesList = ["image1.png", "image2.png", "image3.png"]

for image in imageList:
     try:
          region.wait(image, 0)
          print "image %s found!" %(image)
     except:
          print "image %s NOT found!" %(image)

or even 
imagesList = ["image1.png", "image2.png", "image3.png"]

for image in imageList:
     if region.exists(image, 0):
          print "image %s found!" %(image)
     else:
          print "image %s NOT found!" %(image)

the parameter 0 for wait and exists tells the search process to only do
it once and come back immediately. So in case of not existing image, it
does not carry on searching until the timeout of standard 3 seconds is
reached.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.