import pyautogui as pg
import os
try:
while True:
x,y=pg.position()
positionStr='当前鼠标位置'+str(x).rjust(4)+','+str(y).rjust(4)
print(positionStr)
time.sleep(2)
os.system('cls') # 清除屏幕
except KeyboardInterrupt:
print('已退出')
python获取鼠标的屏幕坐标
最新推荐文章于 2024-11-02 14:33:49 发布