Skip to content

Instantly share code, notes, and snippets.

@PureMath86
Created October 12, 2017 18:44
Show Gist options
  • Save PureMath86/254f5961a85adafb000609e1e77bc361 to your computer and use it in GitHub Desktop.
Save PureMath86/254f5961a85adafb000609e1e77bc361 to your computer and use it in GitHub Desktop.
mouseXY
import pyautogui
def mouse_now():
print('Press Ctrl-C to quit.')
try:
while True:
# Get and print the mouse coordinates.
x, y = pyautogui.position()
positionStr = 'X: ' + str(x).rjust(4) + ' Y: ' + str(y).rjust(4)
print(positionStr, end='')
print('\b'*len(positionStr), end='', flush=True)
except KeyboardInterrupt:
print('\nDone.')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment