Getting cursor position in Python

后端 未结 11 1169
旧巷少年郎
旧巷少年郎 2020-12-02 22:29

Is it possible to get the overall cursor position in Windows using the standard Python libraries?

11条回答
  •  清歌不尽
    2020-12-02 23:04

    win32gui.GetCursorPos(point)
    

    This retrieves the cursor's position, in screen coordinates - point = (x,y)

    flags, hcursor, (x,y) = win32gui.GetCursorInfo()
    

    Retrieves information about the global cursor.

    Links:

    • http://msdn.microsoft.com/en-us/library/ms648389(VS.85).aspx
    • http://msdn.microsoft.com/en-us/library/ms648390(VS.85).aspx

    I am assuming that you would be using python win32 API bindings or pywin32.

提交回复
热议问题