Answers for "how to move mouse in a cercle in python"

1

how to move mouse in a cercle in python

import pyautogui
import math

# Radius 
R = 400
# measuring screen size
(x,y) = pyautogui.size()
# locating center of the screen 
(X,Y) = pyautogui.position(x/2,y/2)
# offsetting by radius 
pyautogui.moveTo(X+R,Y)

for i in range(360):
    # setting pace with a modulus 
    if i%6==0:
       pyautogui.moveTo(X+R*math.cos(math.radians(i)),Y+R*math.sin(math.radians(i)))
Posted by: Guest on May-20-2021

Code answers related to "how to move mouse in a cercle in python"

Python Answers by Framework

Browse Popular Code Answers by Language