KeymouseGo
KeymouseGo copied to clipboard
希望可以在非录制状态下,面板上显示鼠标当前坐标
经常有中途加入录制点的功能,但是要取点又必须重新录制一下再复制出来,希望作者可以加入将当前鼠标坐标直接显示在面板的功能
不是,这坐标怎么是按 %比来,这个太难搞了。想手动录入都不知道如何下手。
好的,考虑作为新版本的 feature
相对坐标和绝对坐标显示.zip 可以结合这个小工具使用,然后搭配下面的python代码将坐标值转为百分数:
from decimal import Decimal, getcontext
import json
# 设置精度
getcontext().prec = 10
# 设置你的屏幕分辨率,我的是2560*1440
def convert_to_relative_coords(location, screen_width=2560, screen_height=1440):
try:
x_str, y_str = location.split(',')
x = Decimal(x_str)
y = Decimal(y_str)
except (ValueError, InvalidOperation) as e:
return f"Error: {e}"
screen_width = Decimal(screen_width)
screen_height = Decimal(screen_height)
relative_x = x / screen_width
relative_y = y / screen_height
# 保留小数点后5位并转换为字符串
relative_x_str = f"{relative_x:.5f}"
relative_y_str = f"{relative_y:.5f}"
return [f"{relative_x_str}%", f"{relative_y_str}%"]
# 示例传入参数
location = '938,250'
# 调用函数并打印结果
relative_coords = convert_to_relative_coords(location)
print(json.dumps(relative_coords))
示例输出: ["0.36641%", "0.17361%"]