how to create a region instance??

Asked by hafsa faiyaz

i have just started using sikuli as part of my final year be project,i wanna know how to create a region instance without using the tool in the ide.i tried Region.selectRegion() but got the following error

Traceback (most recent call last):
  File "C:\DOCUME~1\hafsa\LOCALS~1\Temp\sikuli-tmp6840124297957422154.py", line 1, in <module>
    Region.selectRegion()
AttributeError: type object 'Region' has no attribute 'selectRegion'

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
Best RaiMan (raimund-hocke) said :
#1

Principally you did the right thing -- but uuuups

there the docs might irritate at first glance, since in fact selectRegion() is a Screen method (it is mentioned, but ...)

so the usage is generally Screen(x).selectRegion() or just selectRegion() if you want to select on primary screen (SCREEN).

I will revise the docs.

One more thing:
With Sikuli X-1.0rc1, selectRegion() does not work on windows, so you have to use (only for one or two days until RC2 is out ;-) a manually defined Region using Region(x,y,w,h) or derive it from another one you already have, e.g.
m = find(some_image)
newReg = m.left(1).below().right()

this would give you a region below and right of the match's lower left corner extending to the button and right side of the screen.

have a look at the docs for even more options.

Revision history for this message
hafsa faiyaz (hafsa-faiyaz) said :
#2

Thanks your ans did clear my doubt completely-:).Thanks for the timely and immediate reply-:)