如何使用pyautogui打印“实时"鼠标位置坐标? [英] How to print out 'Live' mouse position coordinates using pyautogui?

查看:38
本文介绍了如何使用pyautogui打印“实时"鼠标位置坐标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了许多不同的源代码,甚至复制和粘贴,但我不断收到随机符号,当我将鼠标移到它们上方时,这些符号会发生变化这是我的代码...

I used lots of different source codes, and even copied and pasted but I keep getting random symbols that shift when i move my mouse over them here is my code...

import pyautogui, time, sys
print('Press Ctrl-C to quit.')
try:
    while True:
        CurserPos = pyautogui.position()
        print('\b' * len(CurserPos), end='\r')
        sys.stdout.flush()

我将输出显示为图像.我对 Python 比较陌生,非常感谢一些专家的建议.谢谢

I will show the output as an image. I am rather new to Python and would really appreciate some expert advice. Thanks

推荐答案

代码:

import pyautogui
pyautogui.displayMousePosition()

这是一些输出:

Press Ctrl-C to quit.
X:  0 Y: 1143 RGB: ( 38,  38,  38)

这是演示视频https://youtu.be/dZLyfbSQPXI?t=809

这篇关于如何使用pyautogui打印“实时"鼠标位置坐标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆