METADATA 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. Metadata-Version: 2.0
  2. Name: keyboard
  3. Version: 0.11.0
  4. Summary: Hook and simulate keyboard events on Windows and Linux
  5. Home-page: https://github.com/boppreh/keyboard
  6. Author: BoppreH
  7. Author-email: boppreh@gmail.com
  8. License: MIT
  9. Keywords: keyboard hook simulate hotkey
  10. Platform: UNKNOWN
  11. Classifier: Development Status :: 4 - Beta
  12. Classifier: License :: OSI Approved :: MIT License
  13. Classifier: Operating System :: Microsoft :: Windows
  14. Classifier: Operating System :: Unix
  15. Classifier: Operating System :: MacOS :: MacOS X
  16. Classifier: Programming Language :: Python :: 2
  17. Classifier: Programming Language :: Python :: 3
  18. Classifier: Topic :: Software Development :: Libraries :: Python Modules
  19. Classifier: Topic :: Utilities
  20. keyboard
  21. ========
  22. Take full control of your keyboard with this small Python library. Hook
  23. global events, register hotkeys, simulate key presses and much more.
  24. Features
  25. --------
  26. - Global event hook on all keyboards (captures keys regardless of
  27. focus).
  28. - **Listen** and **sends** keyboard events.
  29. - Works with **Windows** and **Linux** (requires sudo), with
  30. experimental **OS X** support (thanks @glitchassassin!).
  31. - **Pure Python**, no C modules to be compiled.
  32. - **Zero dependencies**. Trivial to install and deploy, just copy the
  33. files.
  34. - **Python 2 and 3**.
  35. - Complex hotkey support (e.g. ``Ctrl+Shift+M, Ctrl+Space``) with
  36. controllable timeout.
  37. - Includes **high level API** (e.g. `record <#keyboard.record>`__ and
  38. `play <#keyboard.play>`__,
  39. `add\_abbreviation <#keyboard.add_abbreviation>`__).
  40. - Maps keys as they actually are in your layout, with **full
  41. internationalization support** (e.g. ``Ctrl+ç``).
  42. - Events automatically captured in separate thread, doesn't block main
  43. program.
  44. - Tested and documented.
  45. - Doesn't break accented dead keys (I'm looking at you, pyHook).
  46. - Mouse support available via project
  47. `mouse <https://github.com/boppreh/mouse>`__ (``pip install mouse``).
  48. This program makes no attempt to hide itself, so don't use it for
  49. keyloggers.
  50. Usage
  51. -----
  52. Install the `PyPI package <https://pypi.python.org/pypi/keyboard/>`__:
  53. ::
  54. $ sudo pip install keyboard
  55. or clone the repository (no installation required, source files are
  56. sufficient):
  57. ::
  58. $ git clone https://github.com/boppreh/keyboard
  59. Then check the `API docs <https://github.com/boppreh/keyboard#api>`__ to
  60. see what features are available.
  61. Example
  62. -------
  63. ::
  64. import keyboard
  65. keyboard.press_and_release('shift+s, space')
  66. keyboard.write('The quick brown fox jumps over the lazy dog.')
  67. # Press PAGE UP then PAGE DOWN to type "foobar".
  68. keyboard.add_hotkey('page up, page down', lambda: keyboard.write('foobar'))
  69. # Blocks until you press esc.
  70. keyboard.wait('esc')
  71. # Record events until 'esc' is pressed.
  72. recorded = keyboard.record(until='esc')
  73. # Then replay back at three times the speed.
  74. keyboard.play(recorded, speed_factor=3)
  75. # Type @@ then press space to replace with abbreviation.
  76. keyboard.add_abbreviation('@@', 'my.long.email@example.com')
  77. # Block forever.
  78. keyboard.wait()
  79. Known limitations:
  80. ------------------
  81. - Events generated under Windows don't report device id
  82. (``event.device == None``).
  83. `#21 <https://github.com/boppreh/keyboard/issues/21>`__
  84. - Linux doesn't seem to report media keys.
  85. `#20 <https://github.com/boppreh/keyboard/issues/20>`__
  86. - Currently no way to suppress keys ('catch' events and block them).
  87. `#22 <https://github.com/boppreh/keyboard/issues/22>`__
  88. - To avoid depending on X the Linux parts reads raw device files
  89. (``/dev/input/input*``) but this requries root.
  90. - Other applications, such as some games, may register hooks that
  91. swallow all key events. In this case ``keyboard`` will be unable to
  92. report events.