Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1 #!/usr/bin/python
- 2 # get_mouse.py - Displays the mouse cursor's current positions.
- 3
- 4 import pyautogui
- 5
- 6 print('Press Ctrl+C to quite.')
- 7
- 8 # Get and print the mouse coordinates.
- 9 try:
- 10 while True:
- 11 x, y = pyautogui.position()
- 12 postion_str = 'X: ' + str(x).rjust(4) + ' Y: ' + str(y).rjust(4)
- 13 print(postion_str, end='')
- 14 print('\b' * len(postion_str), end='', flush = True)
- 15 except KeyboardInterrupt:
- 16 print('\nDone.')
- ~
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement