Question #228913 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/228913
Status: Open => Answered
RaiMan proposed the following answer:
--- background observe
It is an independent thread running in background until stopObserver() is
called or the parent process is terminated (which will not be the case until
the the test running main process terminates).
So it is always recommended, to use stopObserver(), when the observer is no
longer needed.
In your case I would strongly recommend, to setup and start the observer in
setup() and stop it again in teardown() (this only costs little).
The Settings.ObserveScanRate can be used, to slow down the observation and
hence reduce cpu usage by the observer (the standard rate is 3 per second, so
with an average search of more than 0.3 secs, the observer will be busy near
100% all the time)
--- foreground observe
This form of observer stops the script processing at that point until the
timeout is reached or stopObserver() is called in the handler.
Therefore it is often cheaper and clearer, to use an inline timed loop, that
waits for something to appear (using exists(img, 0)).
--- make your own background observer
using the Jython threading module, you might make your own background observer.
The advantage would be having more options to communicate between main and
thread in a controlled way.
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.
_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to : [email protected]
Unsubscribe : https://launchpad.net/~sikuli-driver
More help : https://help.launchpad.net/ListHelp