Is it possible to get the overall cursor position in Windows using the standard Python libraries?
+2
A:
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.
pyfunc
2010-09-13 07:55:49
+1
A:
You will not find such function in standard Python libraries, while this function is Windows specific. However if you use ActiveState Python, or just install win32api
module to standard Python Windows installation you can use:
x, y = win32api.GetCursorPos()
Michał Niklas
2010-09-13 08:01:37
A:
I found a way to do it that doesn't depend on non-standard libraries!
Found this in Tkinter
self.winfo_pointerxy()
Anteater7171
2010-09-13 19:46:00