Drag and Drop random region
Would appreciate if someone can show me how drag and drop would work via random screen regions.
I have it specify manual coords to do it - And it works, but how can I make so it's completely random and not dependent on manual coords that I provide, this is what I have:
def randomDrag1():
dragDrop(
def randomDrag2():
dragDrop(
def randomDrag3():
dragDrop(
def randomChoice():
all3Locations = [randomDrag1, randomDrag2, randomDrag3]
random.
randomChoice()
Thank you!
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Sikuli Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Manfred Hampl
- Solved:
- 2020-05-02
- Last query:
- 2020-05-02
- Last reply:
- 2020-05-02
Manfred Hampl (m-hampl) said : | #1 |
Probably something like
import random
random.seed()
mywidth = Screen(0).getW()
myheight = Screen(0).getH()
dragDrop(
xyz_User (userseven) said : | #2 |
Thank you Manfred, I'd like to specify about 80% of the screen (or a region) and not the entire full screen. If that makes sense
|
#3 |
Just a small modification, I had expected that you can do the required changes yourself.
Probably something like
import random
random.seed()
myRegion = ... # define your region by whatever means, e.g. by specifying the coordinates, or as a match for a find action, ...
myX = myRegion.getX()
myY = myRegion.getY()
myW = myRegion.getW()
myH = myRegion.getH()
dragDrop(
xyz_User (userseven) said : | #4 |
Thanks very much Manfred!
xyz_User (userseven) said : | #5 |
Thanks Manfred Hampl, that solved my question.