sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #37159
Re: [Question #288351]: Random event& using onAppear
Question #288351 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/288351
Status: Open => Answered
RaiMan proposed the following answer:
this is the intended/correct usage of the observe feature:
--- use a restricting region, where you expect the visual to appear, which should not be the whole screen if ever possible. (someRegion in this case)
--- somewhere at the beginning of the script outside any loop define a handler function (what should be done in case of appear)
def handler(event):
someRegion.click(okayButton)
--- one time outside any loop or repeatedly used function:
someRegion.onAppear(someImage, handler)
--- somewhere in your code start the observing in background
someRegion.observe(FOREVER, True)
Be aware/take care:
-- onAppear() is a one time event (it has to be told to be repeated in case):
e.g. in the handler:
def handler(event):
someRegion.click(okayButton)
event.repeat()
all this can be found in the doc mentioned by Karl before.
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.