在 Python 中获取光标位置 [英] Getting cursor position in Python
本文介绍了在 Python 中获取光标位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以使用标准 Python 库获取 Windows 中的整体光标位置?
Is it possible to get the overall cursor position in Windows using the standard Python libraries?
推荐答案
win32gui.GetCursorPos(point)
这将检索光标的位置,以屏幕坐标表示 - point = (x,y)
This retrieves the cursor's position, in screen coordinates - point = (x,y)
flags, hcursor, (x,y) = win32gui.GetCursorInfo()
检索有关全局光标的信息.
Retrieves information about the global cursor.
链接:
- http://msdn.microsoft.com/en-us/library/ms648389(VS.85).aspx
- http://msdn.microsoft.com/en-us/library/ms648390(VS.85).aspx
我假设您将使用 python win32 API 绑定或 pywin32.
I am assuming that you would be using python win32 API bindings or pywin32.
这篇关于在 Python 中获取光标位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文