I can't get the full screen

Asked by Stranger on 2017-11-06

I write two function as below:

setRect(100,100,10,10)
print capture(getScreen())

After run, I can't get the full screen image.
But if I capture() before setRect(), after run I can get the full screen image, why?

How can I get full screen image after setRect() is used?

And I still don't understand what is the different between setROI and setRect? Could you give an example? From manual, I don't understand, Thanks

Question information

Language:
English Edit question
Status:
Answered
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2017-11-06
Last reply:
2017-11-06
RaiMan (raimund-hocke) said : #1

setRect() and setROI() are functional the same:
set the coordinates (x,y) and the dimension (w,h) to the given values.
That they exist both has historical reasons.

In the undotted use (no explicit region given) they address the current default screen and hence change its (x,y) and (w,h) values.

Since when running in the IDE nothing is reset by default (neither on start nor at end).

So to avoid such unexpected behavior, you should not change the screen, but instead work with Region objects.

myRegion = new Region(100,100,10,10)
myRegion.hover() # moves the mouse to the center of myRegion
capture() # same as capture(getScreen()))

will now capture the hole screen in all cases and a capture after run also.

Can you help with this problem?

Provide an answer of your own, or ask Stranger for more information if necessary.

To post a message you must log in.