2024-06-15 01:36:02 +02:00
|
|
|
from pyautogui import moveTo, size as screen_size, press, position
|
2024-06-12 15:59:21 +02:00
|
|
|
from time import sleep
|
2024-06-13 09:15:00 +02:00
|
|
|
from threading import Thread
|
2024-06-15 01:36:02 +02:00
|
|
|
from math import radians, cos, sin
|
2024-06-13 09:15:00 +02:00
|
|
|
|
2024-06-12 15:59:21 +02:00
|
|
|
|
|
|
|
def action():
|
|
|
|
while True:
|
2024-06-13 09:15:00 +02:00
|
|
|
press("win")
|
|
|
|
sleep(0.5)
|
2024-06-12 15:59:21 +02:00
|
|
|
press("win")
|
|
|
|
sleep(20)
|
|
|
|
|
2024-06-13 09:15:00 +02:00
|
|
|
|
|
|
|
def wait_mouse():
|
|
|
|
previous_x, previous_y = position()
|
|
|
|
threshold = 50
|
|
|
|
|
|
|
|
while True:
|
|
|
|
position_x, position_y = position()
|
2024-06-15 01:36:02 +02:00
|
|
|
if (
|
|
|
|
abs(position_x - previous_x) > threshold
|
|
|
|
or abs(position_y - previous_y) > threshold
|
|
|
|
):
|
2024-06-13 09:15:00 +02:00
|
|
|
return
|
|
|
|
|
|
|
|
previous_x, previous_y = position_x, position_y
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
|
2024-06-15 01:36:02 +02:00
|
|
|
def circle(radius, base_x, base_y, wait):
|
|
|
|
sleep(wait)
|
|
|
|
while True:
|
|
|
|
for angle in range(0, 360, 5):
|
|
|
|
x = base_x + radius * cos(radians(angle))
|
|
|
|
y = base_y + radius * sin(radians(angle))
|
|
|
|
|
|
|
|
moveTo(x, y)
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
|
2024-06-12 15:59:21 +02:00
|
|
|
if __name__ == "__main__":
|
2024-06-15 01:36:02 +02:00
|
|
|
# Win key
|
|
|
|
t1 = Thread(target=action)
|
|
|
|
t1.daemon = True
|
|
|
|
t1.start()
|
|
|
|
|
|
|
|
wait = 5
|
|
|
|
|
|
|
|
# Circle mouse
|
|
|
|
t2 = Thread(
|
|
|
|
target=circle, args=(100, screen_size()[0] // 2, screen_size()[1] // 2, wait)
|
|
|
|
)
|
|
|
|
t2.daemon = True
|
|
|
|
t2.start()
|
2024-06-13 09:15:00 +02:00
|
|
|
|
2024-06-15 01:36:02 +02:00
|
|
|
sleep(wait + 2)
|
2024-06-13 09:15:00 +02:00
|
|
|
wait_mouse()
|