commit 90f8ec7619378772ce8aa12d404a654fa9179173 Author: Anri Date: Fri Jun 7 11:47:06 2024 +0200 Ajouter circle.py diff --git a/circle.py b/circle.py new file mode 100644 index 0000000..5b19720 --- /dev/null +++ b/circle.py @@ -0,0 +1,29 @@ +from pyautogui import moveTo, size as screen_size, position +from time import sleep +from math import radians, cos, sin + +def circle(radius, x, y): + base_x = x + base_y = y + + previous_x, previous_y = position() + threshold = 50 + + while True: + for angle in range(0, 360, 5): + x = base_x + radius * cos(radians(angle)) + y = base_y + radius * sin(radians(angle)) + + position_x, position_y = position() + if (abs(position_x - previous_x) > threshold or abs(position_y - previous_y) > threshold): + return + + moveTo(x, y) + previous_x, previous_y = x, y + sleep(0.1) + +if __name__ == "__main__": + radius = 100 + center_x, center_y = screen_size()[0] // 2, screen_size()[1] // 2 + + circle(radius, center_x, center_y)