← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #695577]: Specify targetOffset(). to match object

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
The intended use of targetOffset() is with a Pattern() object:
somePattern = Pattern(someImage).targetOffset(x, y)
click(somePattern)

Your approach only makes sense, if you want to assign more than one
offset to a match, that is found once and reused several times.

- modifying the match:
match = find(someImage)
click(match.setTargetOffset(x,y))

- not modifying the match (see Manfed Hampel above comment#1):
match = find(someImage)
click(match.getCenter().offset(x, y))

or even shorter:
click(match.offset(x, y))
(this creates a new Region with top-left offset and same size and it's center is clicked then)

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.