diff options
author | mlot <petri-rush-curvy@duck.com> | 2025-06-06 13:40:57 -0400 |
---|---|---|
committer | mlot <petri-rush-curvy@duck.com> | 2025-06-06 13:40:57 -0400 |
commit | 75a42ec54dbf721caa659ddf02c1f46fc2cb4bef (patch) | |
tree | 84be794a2481e356a7784557a6f9fb6fbf29cfdd /Chap18ProjMouseNow.py |
Diffstat (limited to 'Chap18ProjMouseNow.py')
-rw-r--r-- | Chap18ProjMouseNow.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Chap18ProjMouseNow.py b/Chap18ProjMouseNow.py new file mode 100644 index 0000000..7567748 --- /dev/null +++ b/Chap18ProjMouseNow.py @@ -0,0 +1,16 @@ +#! python3 + +# Chapter 18 Project Where is the Mouse Right Now? +# Displays the mouse cursor's current postion + +import pyautogui + +print('Press Ctrl-C to quit.') +try: + while True: + 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.') |