How does one control the mouse cursor in Python, i.e. move it to certain position and click, under Windows?
Move Mouse Randomly On Screen
It will move the mouse randomly on screen according to your screen resolution. check code below.
Install pip install pyautogui
using this command.
import pyautogui
import time
import random as rnd
#calculate height and width of screen
w, h = list(pyautogui.size())[0], list(pyautogui.size())[1]
while True:
time.sleep(1)
#move mouse at random location in screen, change it to your preference
pyautogui.moveTo(rnd.randrange(0, w),
rnd.randrange(0, h))#, duration = 0.1)