Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
23
Task/Simulate-input-Mouse/Python/simulate-input-mouse-2.py
Normal file
23
Task/Simulate-input-Mouse/Python/simulate-input-mouse-2.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import autopy
|
||||
import math
|
||||
import time
|
||||
import random
|
||||
|
||||
TWO_PI = math.pi * 2.0
|
||||
|
||||
|
||||
def sine_mouse_wave():
|
||||
"""
|
||||
Moves the mouse in a sine wave from the left edge of the screen to
|
||||
the right.
|
||||
"""
|
||||
width, height = autopy.screen.get_size()
|
||||
height /= 2
|
||||
height -= 10 # Stay in the screen bounds.
|
||||
|
||||
for x in xrange(width):
|
||||
y = int(height * math.sin((TWO_PI * x) / width) + height)
|
||||
autopy.mouse.move(x, y)
|
||||
time.sleep(random.uniform(0.001, 0.003))
|
||||
|
||||
sine_mouse_wave()
|
||||
Loading…
Add table
Add a link
Reference in a new issue