sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #34896
Re: [Question #272088]: onAppear with an array of images?
Question #272088 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/272088
Status: Open => Answered
RaiMan proposed the following answer:
Yes, one event for one image (currently ;-)
This is the appropriate solution for version 1.1.0+:
r = Region(Region(2516,495,694,273))
leftSide = [("left1.png"), ("left2.png"), ("left3.png"), ("left4.png"), ("left5.png"), ("left6.png"), ("left7.png"), ("left8.png"), ("left9.png"), ("left10.png"), ("left11.png")]
rightSide = [("right1.png"), ("right2.png"), ("right3.png"), ("right4.png"), ("right5.png"), ("right6.png"), ("right7.png"), ("right8.png"), ("right9.png"), ("right10.png"), ("right11.png"), ("right12.png")]
neitherSide = [("center1.png"), ("center2.png"), ("center3.png"), ("center4.png")]
def moveLeft(event):
type(Key.LEFT)
event.repeat(0.2) # continue observation after 0.2 seconds
def moveRight(event):
type(Key.RIGHT)
event.repeat(0.2) # continue observation after 0.2 seconds
# register the events with region r
# one event == one image
for ls in leftSide:
r.onAppear(ls, moveRight)
for rs in rightSide:
r.onAppear(rs, moveLeft)
nor rs in neitherSide:
r.onAppear(ns, moveRight)
# run the observation
r.observe(FOREVER)
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.