Pythonscript that detects screen activity?

Lu
2

Does anyone know of a python script that detects screen activity?

So let's say the following scenario:

I have a virtual assistant that I have programmed so that when I say "Bye, pay attention!" checks in a while true loop whether there's screen activity. So if someone else goes to my laptop and moves the mouse there or opens a window, he should do certain things.

How do i create a command like

check (screen activity)

ha

There are e.g. Pyautogui or simply mouse as modules that can read (or set) the mouse position. Mouse can also listen to mouse events.

pyautogui can also monitor the screen, but you would then have to create something like image comparisons in every monitoring step. I think mouse movement is easy to register.

https://pypi.org/project/mouse/

https://automatetheboringstuff.com/chapter18/#calibre_link-3639

Au

You could keep taking screenshots and use the first one as a reference. If a later one differs then it will be saved or an email sent to you or whatever…