from mouse import get_position, move from random import randint from time import sleep def erratic_movement(screen_width, screen_height): x, y = get_position() move( x + randint(-100, 100) % screen_width, y + randint(-100, 100) % screen_height, ) def main(): screen_width = 1920 screen_height = 1080 while True: erratic_movement(screen_width, screen_height) sleep(randint(2, 10)) if __name__ == "__main__": main()