Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

import time
import pyautogui
import math
from decimal import Decimal
# 获取窗口左上角坐标和宽度、高度
window_name = "Pi Day Challenge by matrix67"
window_info = pyautogui.getWindowsWithTitle(window_name)[0]
window_left = window_info.left
window_top = window_info.top
window_width = window_info.width
window_height = window_info.height
# 点击窗口标题栏,将焦点切换到指定窗口
window_info.activate()
# 计算圆的半径
radius = Decimal(664)
# 计算圆心坐标
center_x = window_left + window_width // 2
center_y = window_top + window_height // 2+Decimal(90)
# 点击窗口标题栏,将焦点切换到指定窗口
pyautogui.click(window_info.left + 50, window_info.top + 10)
# 计算圆上某一点的坐标
angle = 0  # 将角度设置为圆的某个角度,这里设为 45 度
a = center_x + radius * Decimal(math.cos(angle))
b = center_y + radius * Decimal(math.sin(angle))
pyautogui.moveTo(a, b, duration=0)
# 按下鼠标左键
pyautogui.mouseDown(button='left')
time.sleep(0.5)
# 绘制圆形
steps = 100
for step in range(steps+1):
    angle = (Decimal(2) * Decimal(math.pi) / Decimal(steps)) * Decimal(step)
    x = center_x + radius * Decimal(math.cos(angle))
    y = center_y + radius * Decimal(math.sin(angle))
    pyautogui.moveTo(x, y, duration=0)
# 抬起鼠标左键
pyautogui.mouseUp(button='left')
# 恢复鼠标位置
pyautogui.moveTo(center_x, center_y, duration=0)