Advertisement
Guest User

Sikuli drag and flick/swipe examples

a guest
Jun 5th, 2012
344
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.75 KB | None | 0 0
  1. def drag_up():
  2.     # setting begin - end
  3.     x1, y1, x2, y2 = (640, 512, 640, 412)
  4.     start = Location(x1, y1)
  5.     end = Location(x2, y2)
  6.     # moving up
  7.     stepX = 0
  8.     stepY = 10
  9.     run = start
  10.     mouseMove(start); wait(0.5)
  11.     mouseDown(Button.LEFT); wait(0.5)
  12.     for i in range(24):
  13.         run = run.right(stepX).above(stepY)
  14.         mouseMove(run)
  15.         wait(0.1)
  16.     # mouseMove(end)
  17.     mouseUp();
  18.  
  19.  
  20. def flick_up():
  21.     # setting begin - end
  22.     x1, y1, x2, y2 = (640, 682, 640, 412)
  23.     start = Location(x1, y1)
  24.     end = Location(x2, y2)
  25.     # moving up
  26.     stepX = 0
  27.     stepY = 20
  28.     run = start
  29.     mouseMove(start); wait(0.5)
  30.     mouseDown(Button.LEFT); wait(0.5)
  31.     for i in range(5):
  32.             run = run.right(stepX).above(stepY * i)
  33.             mouseMove(run)
  34.             wait(0.05)
  35.     # mouseMove(end)
  36.     mouseUp()
  37.     wait(0.5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement