create a new region only with integers?

Asked by Steffen

Hello, is it possible to create a region without any .png - only with integers which define the x-position, y-position, width height? Like:
myregion = Region(AnyInteger_1, AnyInteger_2, AnyInteger_3, AnyInteger_4)
I wasn't able to do it this way.

I had to do it another way:
myregion = find(AnyCaptureOfTheScreen.png)
myregion.setX(AnyInteger_1)
myregion.setY(AnyInteger_2)
myregion.setW(AnyInteger_3)
myregion.setH(AnyInteger_4)

How can I define a region without any .png (only by integers)?

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Steffen
Solved:
Last query:
Last reply:
Revision history for this message
Steffen (steffen-be) said :
#1

Don't know what I did wrong, but
myregion = Region(AnyInteger_1, AnyInteger_2, AnyInteger_3, AnyInteger_4)
works now for me .
Sorry =/

Revision history for this message
RaiMan (raimund-hocke) said :
#2

BTW: a Region object always is only a rectangle area on the screen:
top left = (x,y)
dimension = w x h

reg = Region(x, y, w, h)

The IDE (I do not really like this gimmick) replaces a Region(x,y,w,h), that contains plain numbers for ALL values with a symbolic thumbnail (reddish rectangle denoting position and size on the screen).
Might be irritating for a new bee (that might not yet have read through all the docs). Hover the thumbnail and you see the Region() formula.

Already using e.g. Region(1+0, 1, 100, 100) prevents the generation of the thumbnail.