← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #195342]: Optimal way to scan constantly in main loop

 

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

RaiMan posted a new comment:
@ j-the-k

your observe solution:
- will scan once and give up after 3 seconds (standard waiting time), because the next scan would only start after 5 seconds

... and it is functional the same as (timing might be slightly
different):

if exists(image, 0): wait(5)
wait(3) 

which surely is much more compact and clear ;-)

if using observe() with some sense:

def handler(e):
    print "I see you"
    e.region.stopObserver()
    wait(5)

onAppear("nextepisode.png",handler)
observe(20)

This would wait max 20 seconds and if found would stop observation and
wait 5 seconds in the handler (I do not know, wether this influences the
main workflow).

I think, that for these simple situations (waiting for one or two
things, while the script is pausing) using exists(image, 0) is much more
compact, transparent and easier.

observe() used in background though, while the script continues, is
really a mighty Sikuli feature, but still rather complex concerning
communication between main flow and handlers.

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