From 7979a980dc3e4a346d26fdc9a424c420c252de56 Mon Sep 17 00:00:00 2001 From: def <8384198-dettlaff@users.noreply.gitlab.com> Date: Wed, 1 Dec 2021 20:44:59 +0000 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D0=BD=D0=BE=D0=B2=D1=8B=D0=B9=20=D1=84=D0=B0?= =?UTF-8?q?=D0=B9=D0=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- soup/nn.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 soup/nn.py diff --git a/soup/nn.py b/soup/nn.py new file mode 100644 index 0000000..c442d48 --- /dev/null +++ b/soup/nn.py @@ -0,0 +1,36 @@ +from pynput import mouse +from PIL import ImageGrab + + +def on_move(x, y): + # image = ImageGrab.grab() + print('Pointer moved to {0}'.format((x, y))) + # color = image.getpixel((x, y)) + # print(color) + +def on_click(x, y, button, pressed): + print('{0} at {1}'.format( + 'Pressed' if pressed else 'Released',(x, y))) + + #if not pressed: + + #print(x, y) + +def on_scroll(x, y, dx, dy): + print('Scrolled {0} at {1}'.format( + 'down' if dy < 0 else 'up', + (x, y))) + +# Collect events until released +with mouse.Listener( + on_move=on_move, + on_click=on_click, + on_scroll=on_scroll) as listener: + listener.join() + +# ...or, in a non-blocking fashion: +listener = mouse.Listener( + on_move=on_move, + on_click=on_click, + on_scroll=on_scroll) +listener.start()