Write script using pynput

This commit is contained in:
coolneng 2020-07-28 12:42:19 +02:00
parent d123352e89
commit 00d24222b1
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
2 changed files with 25 additions and 2 deletions

View File

@ -1 +1,24 @@
from pynput.mouse import Listener from pynput.mouse import Controller
from secrets import randbits
from time import sleep
def initialize_mouse():
mouse = Controller()
return mouse
def erratic_movement(mouse):
x, y = mouse.position
mouse.move(x + randbits(2), y + randbits(2))
sleep(randbits(2))
def main():
mouse = initialize_mouse()
while True:
erratic_movement(mouse)
if __name__ == "__main__":
main()

View File

@ -2,4 +2,4 @@
with pkgs; with pkgs;
mkShell { buildInputs = [ python38Packages.pynput ]; } mkShell { buildInputs = [ python38 python38Packages.pynput ]; }