Skip to content

Instantly share code, notes, and snippets.

@den-run-ai
Forked from Sebelino/keymouseloggertest.py
Created October 4, 2016 14:39
Show Gist options
  • Select an option

  • Save den-run-ai/97be66684366b5526e1df38f46dbdfc0 to your computer and use it in GitHub Desktop.

Select an option

Save den-run-ai/97be66684366b5526e1df38f46dbdfc0 to your computer and use it in GitHub Desktop.

Revisions

  1. @Sebelino Sebelino revised this gist Apr 24, 2016. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions keymouseloggertest.py
    Original file line number Diff line number Diff line change
    @@ -14,8 +14,6 @@
    class KeyListener(PyKeyboardEvent):
    def __init__(self):
    PyKeyboardEvent.__init__(self)
    self.callno = 0
    self.pressedkeys = set()

    def handler(self, reply):
    print("Handle keypress here...")
  2. @Sebelino Sebelino created this gist Apr 24, 2016.
    41 changes: 41 additions & 0 deletions keymouseloggertest.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,41 @@
    #!/usr/bin/env python

    # The following is free software: you can redistribute it and/or modify
    # it under the terms of the GNU General Public License as published by
    # the Free Software Foundation, either version 3 of the License, or
    # (at your option) any later version.

    from pykeyboard import PyKeyboardEvent
    from pymouse import PyMouseEvent
    from threading import Thread
    from time import sleep


    class KeyListener(PyKeyboardEvent):
    def __init__(self):
    PyKeyboardEvent.__init__(self)
    self.callno = 0
    self.pressedkeys = set()

    def handler(self, reply):
    print("Handle keypress here...")


    class MouseListener(PyMouseEvent):
    def __init__(self):
    PyMouseEvent.__init__(self)

    def click(self, x, y, button, press):
    print("Handle mousepress here...")


    if __name__ == '__main__':
    keylistener = KeyListener()
    mouselistener = MouseListener()
    kt = Thread(target=keylistener.run)
    mt = Thread(target=mouselistener.run)
    kt.start()
    mt.start()
    while True:
    print("Running...")
    sleep(10)