User:Ssstephen/prototype/20231113
rodent trace ornamentation
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 do this as a way of ornamenting and documenting the work that happens through the mouse or trackpad. pen plotters are often used for presentations: it is about finding what is between the past and the future. 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)
the data being collected in the script that i can see:
- something happened (listener)
- it happened now (asctime)
- by something, it was either a click, move or scroll
- it happened somewhere xy (this is presented as if it's two pieces of information, weird)
- if it was a click, it involved a particular button (strange my trackpad does not have buttons)
- if it was a scroll it moved to another relative position dxdy