← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #234584]: How to action for sequence of vertical pictures lined up

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
--- I'm confusing whether we can remove "getCenter()" in your code
No, you can't.
It is principally right, that a mouse click on a REGION (area on a screen, that e.g. is returned by a match).

But in this case we are working with a point (x,y), that is first
created by t = find ("pic1.png").getCenter().

the following t = t.below(i) moves the current point step by step towards the lower edge of the screen
the same would be:
t.y = t.y + i

I prefer to use the named functions, since it is clearer telling what
happens.

--- tell me the difference between your original code and modified code.
My solution moves the click point with a constant step value (10) towards lower edge of screen.
Your solution increases the step value with every loop turn with 10 pixels, so the step values would look like this:
10, 20, 30, 40, 50, 60, ....
... and I guess that is not what you want.

BTW: while testing, it is a good idea, to use hover() instead of click (moves only the mouse, but does nothing) and run your script in slow motion mode (yellow run button), so you see what happens.
... and for testing, I would first be satisfied with a 10-times or even 5-times loop ( for k in range(5): )

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