User:Ssstephen/prototype/20231113
rodent
a few weeks ago i made a script that saves my mouse actions to a text file. and by made I mean i pressed, among other buttons, ctrl+c and ctrl+v.
from pynput.mouse import Listener import logging logging.basicConfig(filename="mouse_log.txt", level=logging.DEBUG, format='%(asctime)s: %(message)s') def on_move(x, y): logging.info("Mouse moved to ({0}, {1})".format(x, y)) def on_click(x, y, button, pressed): if pressed: logging.info('Mouse clicked at ({0}, {1}) with {2}'.format(x, y, button)) def on_scroll(x, y, dx, dy): logging.info('Mouse scrolled at ({0}, {1})({2}, {3})'.format(x, y, dx, dy)) with Listener(on_move=on_move, on_click=on_click, on_scroll=on_scroll) as listener: listener.join()
today I want to send that data to the plotter instead in a language it understands. i want to try not to focus on the cartesian coordinates in the data but they might be useful. the data looks kind of like this:
2023-10-25 12:17:36,329: Mouse moved to (1816, 799) 2023-10-25 12:17:36,337: Mouse moved to (1814, 799) 2023-10-25 12:17:36,345: Mouse moved to (1812, 799) 2023-10-25 12:17:36,353: Mouse moved to (1809, 800) 2023-10-25 12:17:36,361: Mouse moved to (1807, 801) 2023-10-25 12:17:36,369: Mouse moved to (1805, 801) 2023-10-25 12:17:36,376: Mouse moved to (1803, 801) 2023-10-25 12:17:36,385: Mouse moved to (1800, 801) 2023-10-25 12:17:36,393: Mouse moved to (1799, 801) 2023-10-25 12:17:36,401: Mouse moved to (1798, 801) 2023-10-25 12:17:36,553: Mouse clicked at (1798, 801) with Button.left 2023-10-25 12:17:36,729: Mouse clicked at (1798, 801) with Button.left 2023-10-25 12:17:37,440: Mouse moved to (1798, 801) 2023-10-25 12:17:37,953: Mouse scrolled at (1798, 801)(0, -1) 2023-10-25 12:17:37,969: Mouse scrolled at (1798, 801)(0, -1) 2023-10-25 12:17:37,977: Mouse scrolled at (1798, 801)(0, -1) 2023-10-25 12:17:37,993: Mouse scrolled at (1798, 801)(0, -1) 2023-10-25 12:17:38,009: Mouse scrolled at (1798, 801)(0, -1) 2023-10-25 12:17:38,033: Mouse scrolled at (1798, 801)(0, -1) 2023-10-25 12:17:38,040: Mouse scrolled at (1798, 801)(0, -1) 2023-10-25 12:17:38,057: Mouse scrolled at (1798, 801)(0, -1) 2023-10-25 12:17:38,065: Mouse scrolled at (1798, 801)(0, -1)