← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #225999]: Precision issues with observe()

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
This might be a general timing problem:

the click() might trigger a global repaint of your GUI. So there might be a short period, where the previously captured image is not visible (the human might not realize) after the click.
With exists(img, 0) this leads to a not found, since the check is made instantly after the click.
If you use exists(img, 1) the internal search the first time (which is the critical interval) waits 1 second and hence finds the image, since it is again visible after the repaint of the GUI.

Since the refImg is visible for some time after the click, this might help (if I am right ;-):
# only the relevant part of your code
def logTime(refCapture, locRegion):
   refImg = capture(locRegion)
   click(refCapture)
   locRegion.exists(refImg, 1) # see comment
   startTime = time.time()
   while True:

-- comment: this will simply assure, that the captured refImg is back on
the screen again after the click and it will be a rather short delay,
since the search time is very short.

This is the only idea I have.

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