From 75a42ec54dbf721caa659ddf02c1f46fc2cb4bef Mon Sep 17 00:00:00 2001 From: mlot Date: Fri, 6 Jun 2025 13:40:57 -0400 Subject: initial commit for archiving --- Chap18ProjMouseNow.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Chap18ProjMouseNow.py (limited to 'Chap18ProjMouseNow.py') 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.') -- cgit