winfo pointerxy

winfo pointerx window
winfo pointery window
winfo pointerxy window

Returns the current location of the mouse in global (root window) coordinates. For pointerxy this is as a pair (i.e., 2-element list) of coordinates, x and y, and for pointerx and pointery this is the x and y member respectively. The window argument should be a Tk widget that is on the display whose mouse location is to be read; most programs will want to use the master toplevel for that (i.e., .).