← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #233360]: How to use the location object

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
Regions are used to identify rectangular areas on the screen for
whatever purposes. Usually they are used to restrict the search region.
But also they can be used as references for other regions or points
(Locations are simply one pixel on the screen).

m = find(some_image)
click(m.getTopLeft())

would click at the top left corner of the found image.

click(m.below(200))

would click at a point 200 pixels towards bottom of screen from center
of found image

r = selectRegion() # lets you select an area
click(r)

would click at the center of the selected area.

Point coordinates (a Location or the top left corner of a region) are given in world coordinates relative to the top left corner of the primary screen:
right below: (positive, positive)
right above: (positive, negative)
left below: (negative, positive)
left above: (negative, negative)

A defined Region or Location will be mapped to the corresponding
physical screen at time of usage (find operations, mouse actions,
capturing, ...). Being completely outside any physical screen at this
time is an error.

More details can be found in the docs: http://doc.sikuli.org

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