[
  {
    "path": ".gitignore",
    "content": "# Byte-compiled / optimized / DLL files\n__pycache__/\n*.py[cod]\n*$py.class\n\n# C extensions\n*.so\n\n# Distribution / packaging\n.Python\nenv/\nbuild/\ndevelop-eggs/\ndist/\ndownloads/\neggs/\n.eggs/\nlib/\nlib64/\nparts/\nsdist/\nvar/\n*.egg-info/\n.installed.cfg\n*.egg\n\n# PyInstaller\n#  Usually these files are written by a python script from a template\n#  before PyInstaller builds the exe, so as to inject date/other infos into it.\n*.manifest\n*.spec\n\n# Installer logs\npip-log.txt\npip-delete-this-directory.txt\n\n# Unit test / coverage reports\nhtmlcov/\n.tox/\n.coverage\n.coverage.*\n.cache\nnosetests.xml\ncoverage.xml\n*,cover\n.hypothesis/\n\n# Translations\n*.mo\n*.pot\n\n# Django stuff:\n*.log\nlocal_settings.py\n\n# Flask stuff:\ninstance/\n.webassets-cache\n\n# Scrapy stuff:\n.scrapy\n\n# Sphinx documentation\ndocs/_build/\n\n# PyBuilder\ntarget/\n\n# IPython Notebook\n.ipynb_checkpoints\n\n# pyenv\n.python-version\n\n# celery beat schedule file\ncelerybeat-schedule\n\n# dotenv\n.env\n\n# virtualenv\nvenv/\nENV/\n\n# Spyder project settings\n.spyderproject\n\n# Rope project settings\n.ropeproject\n"
  },
  {
    "path": "LGPL",
    "content": "                   GNU LESSER GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n\n  This version of the GNU Lesser General Public License incorporates\nthe terms and conditions of version 3 of the GNU General Public\nLicense, supplemented by the additional permissions listed below.\n\n  0. Additional Definitions.\n\n  As used herein, \"this License\" refers to version 3 of the GNU Lesser\nGeneral Public License, and the \"GNU GPL\" refers to version 3 of the GNU\nGeneral Public License.\n\n  \"The Library\" refers to a covered work governed by this License,\nother than an Application or a Combined Work as defined below.\n\n  An \"Application\" is any work that makes use of an interface provided\nby the Library, but which is not otherwise based on the Library.\nDefining a subclass of a class defined by the Library is deemed a mode\nof using an interface provided by the Library.\n\n  A \"Combined Work\" is a work produced by combining or linking an\nApplication with the Library.  The particular version of the Library\nwith which the Combined Work was made is also called the \"Linked\nVersion\".\n\n  The \"Minimal Corresponding Source\" for a Combined Work means the\nCorresponding Source for the Combined Work, excluding any source code\nfor portions of the Combined Work that, considered in isolation, are\nbased on the Application, and not on the Linked Version.\n\n  The \"Corresponding Application Code\" for a Combined Work means the\nobject code and/or source code for the Application, including any data\nand utility programs needed for reproducing the Combined Work from the\nApplication, but excluding the System Libraries of the Combined Work.\n\n  1. Exception to Section 3 of the GNU GPL.\n\n  You may convey a covered work under sections 3 and 4 of this License\nwithout being bound by section 3 of the GNU GPL.\n\n  2. Conveying Modified Versions.\n\n  If you modify a copy of the Library, and, in your modifications, a\nfacility refers to a function or data to be supplied by an Application\nthat uses the facility (other than as an argument passed when the\nfacility is invoked), then you may convey a copy of the modified\nversion:\n\n   a) under this License, provided that you make a good faith effort to\n   ensure that, in the event an Application does not supply the\n   function or data, the facility still operates, and performs\n   whatever part of its purpose remains meaningful, or\n\n   b) under the GNU GPL, with none of the additional permissions of\n   this License applicable to that copy.\n\n  3. Object Code Incorporating Material from Library Header Files.\n\n  The object code form of an Application may incorporate material from\na header file that is part of the Library.  You may convey such object\ncode under terms of your choice, provided that, if the incorporated\nmaterial is not limited to numerical parameters, data structure\nlayouts and accessors, or small macros, inline functions and templates\n(ten or fewer lines in length), you do both of the following:\n\n   a) Give prominent notice with each copy of the object code that the\n   Library is used in it and that the Library and its use are\n   covered by this License.\n\n   b) Accompany the object code with a copy of the GNU GPL and this license\n   document.\n\n  4. Combined Works.\n\n  You may convey a Combined Work under terms of your choice that,\ntaken together, effectively do not restrict modification of the\nportions of the Library contained in the Combined Work and reverse\nengineering for debugging such modifications, if you also do each of\nthe following:\n\n   a) Give prominent notice with each copy of the Combined Work that\n   the Library is used in it and that the Library and its use are\n   covered by this License.\n\n   b) Accompany the Combined Work with a copy of the GNU GPL and this license\n   document.\n\n   c) For a Combined Work that displays copyright notices during\n   execution, include the copyright notice for the Library among\n   these notices, as well as a reference directing the user to the\n   copies of the GNU GPL and this license document.\n\n   d) Do one of the following:\n\n       0) Convey the Minimal Corresponding Source under the terms of this\n       License, and the Corresponding Application Code in a form\n       suitable for, and under terms that permit, the user to\n       recombine or relink the Application with a modified version of\n       the Linked Version to produce a modified Combined Work, in the\n       manner specified by section 6 of the GNU GPL for conveying\n       Corresponding Source.\n\n       1) Use a suitable shared library mechanism for linking with the\n       Library.  A suitable mechanism is one that (a) uses at run time\n       a copy of the Library already present on the user's computer\n       system, and (b) will operate properly with a modified version\n       of the Library that is interface-compatible with the Linked\n       Version.\n\n   e) Provide Installation Information, but only if you would otherwise\n   be required to provide such information under section 6 of the\n   GNU GPL, and only to the extent that such information is\n   necessary to install and execute a modified version of the\n   Combined Work produced by recombining or relinking the\n   Application with a modified version of the Linked Version. (If\n   you use option 4d0, the Installation Information must accompany\n   the Minimal Corresponding Source and Corresponding Application\n   Code. If you use option 4d1, you must provide the Installation\n   Information in the manner specified by section 6 of the GNU GPL\n   for conveying Corresponding Source.)\n\n  5. Combined Libraries.\n\n  You may place library facilities that are a work based on the\nLibrary side by side in a single library together with other library\nfacilities that are not Applications and are not covered by this\nLicense, and convey such a combined library under terms of your\nchoice, if you do both of the following:\n\n   a) Accompany the combined library with a copy of the same work based\n   on the Library, uncombined with any other library facilities,\n   conveyed under the terms of this License.\n\n   b) Give prominent notice with the combined library that part of it\n   is a work based on the Library, and explaining where to find the\n   accompanying uncombined form of the same work.\n\n  6. Revised Versions of the GNU Lesser General Public License.\n\n  The Free Software Foundation may publish revised and/or new versions\nof the GNU Lesser General Public License from time to time. Such new\nversions will be similar in spirit to the present version, but may\ndiffer in detail to address new problems or concerns.\n\n  Each version is given a distinguishing version number. If the\nLibrary as you received it specifies that a certain numbered version\nof the GNU Lesser General Public License \"or any later version\"\napplies to it, you have the option of following the terms and\nconditions either of that published version or of any later version\npublished by the Free Software Foundation. If the Library as you\nreceived it does not specify a version number of the GNU Lesser\nGeneral Public License, you may choose any version of the GNU Lesser\nGeneral Public License ever published by the Free Software Foundation.\n\n  If the Library as you received it specifies that a proxy can decide\nwhether future versions of the GNU Lesser General Public License shall\napply, that proxy's public statement of acceptance of any version is\npermanent authorization for you to choose that version for the\nLibrary.\n"
  },
  {
    "path": "MANIFEST",
    "content": "# file GENERATED by distutils, do NOT edit\nsetup.cfg\nsetup.py\npyhooked\\__init__.py\n"
  },
  {
    "path": "change-log.md",
    "content": "#Change log for Hooked:\r#####v0.5:\r* Initial module\r* Had hook to raw key-codes and scan-codes\r* Parsed these codes into names of the keys.\r* Limited dependencies to just standard library modules.\r* functions called when keys pressed\r\r#####v0.6:\r* added many mouse hooks\r* Left, middle, and right button presses are supported\r* Scrolling the scroll wheel is supported.\r* Hooking mouse coordinates is supported.\r* Passing arguments on function call supported.\r\r#####v0.7:\r* release to PyPi\r\r#####v0.8:\r* major overhaul of code to optimize and improve code quality and efficiency (expect a v0.9)\r* may have breaking changes\r* 64bit support thanks to @swprojects\r* fixed memory access violation due to conflicting with UI frameworks.\r\r#####v0.8.1\r* fix for keys held down thanks to @denniseffing\r\r\r"
  },
  {
    "path": "example.py",
    "content": "from pyhooked import Hook, KeyboardEvent, MouseEvent\n\n\ndef handle_events(args):\n    if isinstance(args, KeyboardEvent):\n        print(args.key_code)\n        if args.current_key == 'A' and args.event_type == 'key down' and 'Lcontrol' in args.pressed_key:\n            print(\"Ctrl + A was pressed\")\n        elif args.current_key == 'Q' and args.event_type == 'key down' and 'Lcontrol' in args.pressed_key:\n            hk.stop()\n            print('Quitting.')\n\n    if isinstance(args, MouseEvent):\n        if args.mouse_x == 300 and args.mouse_y == 400:\n            print(\"Mouse is at (300,400\") \n\nhk = Hook()  # make a new instance of PyHooked\nhk.handler = handle_events  # add a new shortcut ctrl+a, or triggered on mouseover of (300,400)\nhk.hook()  # hook into the events, and listen to the presses\n"
  },
  {
    "path": "example_gui.py",
    "content": "import sys\nfrom pyhooked import Hook, KeyboardEvent\nimport threading\nfrom PySide.QtCore import *\nfrom PySide.QtGui import *\n\n\nclass MyWindow(QMainWindow):\n    def __init__(self, *args):\n        QMainWindow.__init__(self, *args)\n\n        self.label = QLabel(self)\n        self.label.setText('A PySide Window')\n        self.resize(640, 480)\n        hk = Hook()  # make a new instance of PyHooked\n        hk.handler = self.foo  # set the handler function\n        # thread the call to hook, otherwise we block the GUI\n        thread = threading.Thread(target=hk.hook)\n        # start hooking\n        thread.start()\n\n    def foo(self, args):\n        if isinstance(args, KeyboardEvent):\n            print(args.key_code)\n            if args.current_key == 'A' and args.event_type == 'key down' and 'Lcontrol' in args.pressed_key:\n                self.label.setText(\"Ctrl + A was pressed\")\n\n\nif __name__ == \"__main__\":\n    app = QApplication(sys.argv)\n    w = MyWindow()\n    w.show()\n    sys.exit(app.exec_())\n"
  },
  {
    "path": "pyhooked/__init__.py",
    "content": "\"\"\"\nThis file is part of pyhooked, an LGPL licensed pure Python hotkey module for Windows\nCopyright (C) 2016 Ethan Smith\n\n\"\"\"\nimport ctypes\nfrom ctypes import wintypes\nfrom ctypes import CFUNCTYPE, POINTER, c_int, c_uint, c_void_p, windll\nfrom ctypes import byref\nfrom warnings import warn\nfrom traceback import format_exc\nimport atexit\n\n__version__ = '0.8.1'\n\ncmp_func = CFUNCTYPE(c_int, c_int, wintypes.HINSTANCE, POINTER(c_void_p))\n\n# redefine names to avoid needless clutter\nGetModuleHandleA = ctypes.windll.kernel32.GetModuleHandleA\nSetWindowsHookExA = ctypes.windll.user32.SetWindowsHookExA\nGetMessageW = ctypes.windll.user32.GetMessageW\nDispatchMessageW = ctypes.windll.user32.DispatchMessageW\nTranslateMessage = ctypes.windll.user32.TranslateMessage\nCallNextHookEx = ctypes.windll.user32.CallNextHookEx\nUnhookWindowsHookEx = ctypes.windll.user32.UnhookWindowsHookEx\n\n# specify the argument and return types of functions\nGetModuleHandleA.restype = wintypes.HMODULE\nGetModuleHandleA.argtypes = [wintypes.LPCWSTR]\nSetWindowsHookExA.restype = c_int\nSetWindowsHookExA.argtypes = [c_int, cmp_func, wintypes.HINSTANCE, wintypes.DWORD]\nGetMessageW.argtypes = [POINTER(wintypes.MSG), wintypes.HWND, c_uint, c_uint]\nTranslateMessage.argtypes = [POINTER(wintypes.MSG)]\nDispatchMessageW.argtypes = [POINTER(wintypes.MSG)]\n\n\ndef _callback_pointer(handler):\n    \"\"\"Create and return C-pointer\"\"\"\n    return cmp_func(handler)\n\n\nclass BaseEvent(object):\n    \"\"\"A keyboard or mouse event.\"\"\"\n    pass\n\nclass KeyboardEvent(BaseEvent):\n    \"\"\"Class to describe an event triggered by the keyboard\"\"\"\n\n    def __init__(self, current_key=None, event_type=None, pressed_key=None, key_code=None):\n        self.current_key = current_key\n        self.event_type = event_type\n        self.pressed_key = pressed_key\n        self.key_code = key_code\n\n\nclass MouseEvent(BaseEvent):\n    \"\"\"Class to describe an event triggered by the mouse\"\"\"\n\n    def __init__(self, current_key=None, event_type=None, mouse_x=None, mouse_y=None):\n        self.current_key = current_key\n        self.event_type = event_type\n        self.mouse_x = mouse_x\n        self.mouse_y = mouse_y\n\n\n# The following section contains dictionaries that map key codes and other event codes to the event type (e.g. key up)\n# and the key or button doing the action (e.g. Tab)\nMOUSE_ID_TO_KEY = {512: 'Move',\n                   513: 'LButton',\n                   514: 'LButton',\n                   516: 'RButton',\n                   517: 'RButton',\n                   519: 'WheelButton',\n                   520: 'WheelButton',\n                   522: 'Wheel'}\n\nMOUSE_ID_TO_EVENT_TYPE = {512: None,\n                          513: 'key down',\n                          514: 'key up',\n                          516: 'key down',\n                          517: 'key up',\n                          519: 'key down',\n                          520: 'key up',\n                          522: None}\n\n# stores the relation between keyboard event codes and the key pressed. Reference:\n# https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx\n# seems to only work on 32 bits\nID_TO_KEY = {8: 'Back',\n             9: 'Tab',\n             13: 'Return',\n             20: 'Capital',\n             27: 'Escape',\n             32: 'Space',\n             33: 'Prior',\n             34: 'Next',\n             35: 'End',\n             36: 'Home',\n             37: 'Left',\n             38: 'Up',\n             39: 'Right',\n             40: 'Down',\n             44: 'PrtScr',\n             46: 'Delete',\n             48: '0',\n             49: '1',\n             50: '2',\n             51: '3',\n             52: '4',\n             53: '5',\n             54: '6',\n             55: '7',\n             56: '8',\n             57: '9',\n             65: 'A',\n             66: 'B',\n             67: 'C',\n             68: 'D',\n             69: 'E',\n             70: 'F',\n             71: 'G',\n             72: 'H',\n             73: 'I',\n             74: 'J',\n             75: 'K',\n             76: 'L',\n             77: 'M',\n             78: 'N',\n             79: 'O',\n             80: 'P',\n             81: 'Q',\n             82: 'R',\n             83: 'S',\n             84: 'T',\n             85: 'U',\n             86: 'V',\n             87: 'W',\n             88: 'X',\n             89: 'Y',\n             90: 'Z',\n             91: 'Lwin',\n             92: 'Rwin',\n             93: 'App',\n             95: 'Sleep',\n             96: 'Numpad0',\n             97: 'Numpad1',\n             98: 'Numpad2',\n             99: 'Numpad3',\n             100: 'Numpad4',\n             101: 'Numpad5',\n             102: 'Numpad6',\n             103: 'Numpad7',\n             104: 'Numpad8',\n             105: 'Numpad9',\n             106: 'Multiply',\n             107: 'Add',\n             109: 'Subtract',\n             110: 'Decimal',\n             111: 'Divide',\n             112: 'F1',\n             113: 'F2',\n             114: 'F3',\n             115: 'F4',\n             116: 'F5',\n             117: 'F6',\n             118: 'F7',\n             119: 'F8',\n             120: 'F9',\n             121: 'F10',\n             122: 'F11',\n             123: 'F12',\n             144: 'Numlock',\n             160: 'Lshift',\n             161: 'Rshift',\n             162: 'Lcontrol',\n             163: 'Rcontrol',\n             164: 'Lmenu',\n             165: 'Rmenu',\n             186: 'Oem_1',\n             187: 'Oem_Plus',\n             188: 'Oem_Comma',\n             189: 'Oem_Minus',\n             190: 'Oem_Period',\n             191: 'Oem_2',\n             192: 'Oem_3',\n             219: 'Oem_4',\n             220: 'Oem_5',\n             221: 'Oem_6',\n             222: 'Oem_7',\n             #223: 'OEM_8',\n             1001: 'mouse left',  # mouse hotkeys\n             1002: 'mouse right',\n             1003: 'mouse middle',\n             1000: 'mouse move',  # single event hotkeys\n             1004: 'mouse wheel up',\n             1005: 'mouse wheel down',\n             1010: 'Ctrl',  # merged hotkeys\n             1011: 'Alt',\n             1012: 'Shift',\n             1013: 'Win',\n             }\n\nevent_types = {0x100: 'key down',  # WM_KeyDown for normal keys\n               0x101: 'key up',  # WM_KeyUp for normal keys\n               0x104: 'key down',  # WM_SYSKEYDOWN, used for Alt key.\n               0x105: 'key up',  # WM_SYSKEYUP, used for Alt key.\n               }\n# these are used for specifying the hook type we want to make\nWH_KEYBOARD_LL = 0x00D\nWH_MOUSE_LL = 0x0E\n# the Windows quit message, if the program quits while listening.\nWM_QUIT = 0x0012\n\n\nclass Hook(object):\n    \"\"\"Main hotkey class used to and listen for hotkeys. Set an event handler to check what keys are pressed.\"\"\"\n\n    def __init__(self, warn_unrecognised = False):\n        \"\"\"Initializer of the Hook class, creates class attributes. If warn_unrecognised is True, warn when an unrecognised key is pressed.\"\"\"\n        self.warn_unrecognised = warn_unrecognised\n        self.pressed_keys = []\n        self.keyboard_id = None\n        self.mouse_id = None\n        self.mouse_is_hook = False\n        self.keyboard_is_hook = True\n\n    def handler(self, event):\n        \"\"\"Handle keyboard and mouse events.\"\"\"\n        raise NotImplementedError()\n    \n    def stop(self):\n        \"\"\"Stop this object from listening.\"\"\"\n        windll.user32.PostQuitMessage (0)\n    \n    def hook(self, keyboard=True, mouse=False):\n        \"\"\"Hook mouse and/or keyboard events\"\"\"\n        self.mouse_is_hook = mouse\n        self.keyboard_is_hook = keyboard\n\n        # check that we are going to hook into at least one device\n        if not self.mouse_is_hook and not self.keyboard_is_hook:\n            raise Exception(\"You must hook into either the keyboard and/or mouse events\")\n\n        if self.keyboard_is_hook:\n            def keyboard_low_level_handler(code, event_code, kb_data_ptr):\n                \"\"\"Used to catch keyboard events and deal with the event\"\"\"\n                key_code = 0xFFFFFFFF & kb_data_ptr[0]  # key code\n                current_key = ID_TO_KEY.get(key_code) # check the type of event (see ID_TO_KEY for a list)\n                if current_key is None:\n                    event = None # We can check this later.\n                    if self.warn_unrecognised:\n                        warn('Unrecognised key ID %d.' % key_code)\n                else:\n                    event_type = event_types[0xFFFFFFFF & event_code]\n\n                    if event_type == 'key down':  # add key to those down to list\n                        if current_key not in self.pressed_keys:\n                            self.pressed_keys.append(current_key)\n\n                    if event_type == 'key up':  # remove when no longer pressed\n                        try:\n                            self.pressed_keys.remove(current_key)\n                        except ValueError:\n                            pass # current_key is not in the list.\n\n                    # wrap the keyboard information grabbed into a container class\n                    event = KeyboardEvent(current_key, event_type, self.pressed_keys, key_code)\n\n                # Call the event handler to deal with keys in the list\n                try:\n                    if event:\n                        self.handler(event)\n                except Exception as e:\n                    warn('While handling {}, self.handler produced a traceback:\\n{}'.format(event, format_exc()))\n                finally:\n                    # TODO: fix return here to use non-blocking call\n                    return CallNextHookEx(self.keyboard_id, code, event_code, kb_data_ptr)\n\n            keyboard_pointer = _callback_pointer(keyboard_low_level_handler)\n\n            self.keyboard_id = SetWindowsHookExA(WH_KEYBOARD_LL, keyboard_pointer,\n                                                 GetModuleHandleA(None),\n                                                 0)\n\n        if self.mouse_is_hook:\n            def mouse_low_level_handler(code, event_code, kb_data_ptr):\n                \"\"\"Used to catch and deal with mouse events\"\"\"\n                current_key = MOUSE_ID_TO_KEY.get(event_code)  # check the type of event (see MOUSE_ID_TO_KEY for a list)\n                if current_key is None:\n                    event = None # We can check this later.\n                    if self.warn_unrecognised:\n                        warn('Unrecognised mouse ID %d.' % event_code)\n                else:\n                    if current_key != 'Move':  # if we aren't moving, then we deal with a mouse click\n                        event_type = MOUSE_ID_TO_EVENT_TYPE[event_code]\n                        # the first two members of kb_data_ptr hold the mouse position, x and y\n                        event = MouseEvent(current_key, event_type, kb_data_ptr[0], kb_data_ptr[1])\n\n                try:\n                    if event:\n                        self.handler(event)\n                except Exception as e:\n                    warn('While handling {}, self.handler produced a traceback:\\n{}'.format(event, format_exc()))\n                finally:\n                   # TODO: fix return here to use non-blocking call\n                    return CallNextHookEx(self.mouse_id, code, event_code, kb_data_ptr)\n\n            mouse_pointer = _callback_pointer(mouse_low_level_handler)\n            self.mouse_id = SetWindowsHookExA(WH_MOUSE_LL, mouse_pointer,\n                                              GetModuleHandleA(None), 0)\n\n        atexit.register(UnhookWindowsHookEx, self.keyboard_id)\n        atexit.register(UnhookWindowsHookEx, self.mouse_id)\n\n        message = wintypes.MSG()\n        while self.mouse_is_hook or self.keyboard_is_hook:\n            msg = GetMessageW(byref(message), 0, 0, 0)\n            if msg in [0, -1]:\n                self.unhook_keyboard()\n                self.unhook_mouse()\n                break # Exit the loop.\n\n            else:\n                TranslateMessage(byref(message))\n                DispatchMessageW(byref(message))\n\n    def unhook_mouse(self):\n        \"\"\"Stop listening to the mouse\"\"\"\n        if self.mouse_is_hook:\n            self.mouse_is_hook = False\n            UnhookWindowsHookEx(self.mouse_id)\n\n    def unhook_keyboard(self):\n        \"\"\"Stop listening to the keyboard\"\"\"\n        if self.keyboard_is_hook:\n            self.keyboard_is_hook = False\n            UnhookWindowsHookEx(self.keyboard_id)\n"
  },
  {
    "path": "readme.md",
    "content": "# PyHooked: a pure Python hotkey module\n\n\n[![Join the chat at https://gitter.im/IronManMark20/pyhooked](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/IronManMark20/pyhooked?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)\n\n### ATTENTION: pyhooked has been deprecated in favor of [keyboard](https://github.com/boppreh/keyboard) for new projects. This library is will no longer be supported. Please use one keyboard or one of the alternatives listed in Alternatives.\n\n#### About - \nPyHooked is a pure python keyboard and mouse hotkey module that allows the creation of hotkeys in all Python implementations that support sane implementations of ctypes. Instead of messing around with low level Windows calls, just give Hooked a callback and tell it to start listening.\n\nPyHooked supports IronPython (2.7.5+, incl. 2.7.6 RC2), PyPy (5.3.1+) and CPython (Tested:2.7 x86,3.4 x64,3.5 x86; Most are likely to work) currently. It is pure Python, so porting to other Python implementations and versions should be very simple.\n\n#### Usage - \nPlease see [example.py](https://github.com/ethanhs/pyhooked/blob/master/example.py) for a basic example.\n\nIf you are using it with a UI library, please see [example_gui.py](https://github.com/ethanhs/pyhooked/blob/master/example_gui.py)\n\nPlease note that the wiki is out of date, and needs to be updated.\n\n#### Installing\n\nJust run `$ pip install pyhooked` or\n`$ pip install git+https://github.com/ethanhs/pyhooked.git` to get the latest version.\n\n\n#### Alternatives -\n[pyHook](http://sourceforge.net/projects/pyhook/) and [pyhk](https://github.com/schurpf/pyhk) inspired the creation of this project. They are great hotkey modules too!\n\n[pywinauto](https://github.com/pywinauto/pywinauto) is an incredibly useful Windows automation library that also includes among a plethora of tools, a hotkey detection library.\n\n#### License - \nPyHooked  Copyright (C) 2015  Ethan Smith\nThis program comes with ABSOLUTELY NO WARRANTY;\nThis is free software, and you are welcome to redistribute it\nunder certain conditions;\nPyHooked is licensed under the LGPL v3, or at your choice, any later version. This program comes with the lgpl in a .txt file.\n\nPyhooked v0.8+ is based on work by Maxim Samokhvalov, who has my graditude for his work, and others in the PyWinAuto project, licensed under the BSD 3-clause license. The copyright notice is given below.\n\n     Copyright (C) 2016 Maxim Samokhvalov\n     Copyright (C) 2016 Vasily Ryabov\n     Copyright (C) 2016 ethanhs\n     All rights reserved.\n    \n     Redistribution and use in source and binary forms, with or without\n     modification, are permitted provided that the following conditions are met:\n    \n     * Redistributions of source code must retain the above copyright notice, this\n       list of conditions and the following disclaimer.\n    \n     * Redistributions in binary form must reproduce the above copyright notice,\n       this list of conditions and the following disclaimer in the documentation\n       and/or other materials provided with the distribution.\n    \n     * Neither the name of pywinauto nor the names of its\n       contributors may be used to endorse or promote products derived from\n       this software without specific prior written permission.\n    \n     * Neither the name of hooks.py nor the names of its\n       contributors may be used to endorse or promote products derived from\n       this software without specific prior written permission.\n    \n    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\n    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n    CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n    OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \n\n\n\n#####As of v0.6, the module is LGPL licensed, not under the GPL.\n\n####The Future - \nHere are a few things that I would like to see:\n* ~~add support for args for called functions~~  __(DONE)__\n* ~~get mouse inputs~~  __(DONE)__\n* ~~support all scancodes found [here](https://msdn.microsoft.com/en-us/library/aa299374%28v=vs.60%29.aspx)~~  __(DONE)__\n* Jython support\n* ????<br>\nI am open to feature requests. If you have ideas, let me know (mr.smittye (at) gmail). Or, even better, make your changes and a pull request!\n"
  },
  {
    "path": "setup.cfg",
    "content": "[metadata]\ndescription-file = readme.md"
  },
  {
    "path": "setup.py",
    "content": "from setuptools import setup\n\nsetup(\n    name='pyhooked',\n    packages=['pyhooked'],\n    version='0.8.1',\n    description='Pure Python hotkey hook, with thanks to pyHook, pywinauto, and pyhk',\n    author='Ethan Smith',\n    author_email='ethan@ethanhs.me',\n    url='https://github.com/ethanhs/pyhooked',\n    download_url=\"https://github.com/ethanhs/pyhooked/tarball/0.8.1\",\n    keywords=['hotkey', 'shortcut', 'windows', 'keyboard', 'hooks', 'hook'],\n    classifiers=[],\n)\n"
  },
  {
    "path": "test.py",
    "content": "from pyhooked import Hook, KeyboardEvent\r\n\r\nh = Hook()\r\n\r\ndef f(event):\r\n if isinstance(event, KeyboardEvent):\r\n  print(event.pressed_key)\r\n  if event.pressed_key == ['Q']:\r\n   h.stop()\r\n  else:\r\n   raise Exception()\r\n\r\nh.handler = f\r\n\r\nif __name__ == '__main__':\r\n h.hook(mouse = True)\r\n"
  }
]