← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #240256]: need help on region.text() based on the position click

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
the click location ([500,300] in your case) is the center of the match
of the used image (button in your case)

click("button.png")
button = getLastMatch() # the area of the button image match

so depending how the new region should be positioned relative to the
button match:

-- with ref to the top left corner of the match:
r = Region(button.getTopLeft().x+100, button.getTopLeft().y+50, 400 200)

-- with ref to the click point:
r = Region(button.getCenter().x+100, button.getCenter().y+50, 400 200)

the Region spatial methods (right(), above(), ...) might as well be used
to create suitable regions relative to other regions.

version 1.0.1 has some convenience functions for these cases.

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