python - 从bash或python检测当前鼠标光标类型的方法

标签 python bash python-3.x x11 xdotool

我知道我可以通过执行“xdotool getmouselocation”来获取鼠标光标的当前位置。

我想从 bash 终端或 python 代码检测当前鼠标光标类型,例如指针、光束或手形光标。这可能吗?

谢谢。 六月

最佳答案

在 MS Windows 上:

import win32gui    
win32gui.GetCursorInfo()

将返回类似的内容

(1, 65539, (1920, 1080))

第二个数字是光标类型的ID

在 Windows 10 上我得到:

  • 65539 ​​- 正常

  • 65567 - 指针

  • 65541 - 插入

关于python - 从bash或python检测当前鼠标光标类型的方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45097307/

相关文章:

python - 根据其他列值生成列

python - 使用 linux 别名运行(分离的)QProcess 并获得结果

python-3.x - Matplotlib FuncAnimation 没有动画线图

python - 创建用于将非字母数字字符转换为破折号的 Python 类

python-3.x - 路易吉全局变量

python - 在 Mavericks 上运行 Mercurial

python - Unicode解码错误: 'ascii' codec can't decode byte 0x96 in position 10: ordinal not in range(128)

python 中的curl --interface 等价物

bash - 将参数从 shell 脚本传递到 hive 脚本

bash - 在查找两个模式之间的字符串时如何在 sed 中使用环境变量?