Skip to main content

Hook and simulate keyboard events on Windows and Linux

Project description

Take full control of your keyboard with this small Python library. Hook global events, register hotkeys, simulate key presses and much more.

  • Global event hook (captures keys regardless of focus).

  • Simulates key presses.

  • Complex hotkey support (e.g. Ctrl+Shift+A followed by Alt+Space) with controllable timeout.

  • Maps keys as they actually are in your layout, with full internationalization support (‘Ctrl+ç’).

  • Events automatically captured in separate thread, doesn’t block main program.

  • Pure Python, no C modules to be compiled.

  • Zero dependencies. Trivial to install and deploy.

  • Works with Windows and Linux (if you have a Mac, pull requests are welcome).

  • Python 2 and Python 3.

  • Tested and documented.

  • Doesn’t break accented dead keys (I’m looking at you, pyHook)

  • Mouse support coming soon.

Example:

import keyboard

# Press PAGE UP then PAGE DOWN to type "foobar".
keyboard.add_hotkey('page up, page down', lambda: keyboard.write('foobar'))

# Blocks until you press esc.
wait('esc')

This program makes no attempt to hide itself, so don’t use it for keyloggers.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

keyboard-0.7.0.zip (21.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

keyboard-0.7.0.win-amd64.zip (49.1 kB view details)

Uploaded Source

keyboard-0.7.0-py2.py3-none-any.whl (19.1 kB view details)

Uploaded Python 2Python 3

File details

Details for the file keyboard-0.7.0.zip.

File metadata

  • Download URL: keyboard-0.7.0.zip
  • Upload date:
  • Size: 21.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for keyboard-0.7.0.zip
Algorithm Hash digest
SHA256 10dc0eb8cad103b6c767d3b6e79f75a119745651a8ce1aacfc4ab39e4e494a7b
MD5 890cc0916e69bf3e7e61b9e403ca09cd
BLAKE2b-256 e0333901a35b135e11865268e9ab78eb04a6da9be2aa1b9fabcb7aeef9e86aaa

See more details on using hashes here.

File details

Details for the file keyboard-0.7.0.win-amd64.zip.

File metadata

File hashes

Hashes for keyboard-0.7.0.win-amd64.zip
Algorithm Hash digest
SHA256 f453056ea230bd5e48f13ae42ca2639c4b9ced0c2feb76dbb2b78ac0ab5a66b5
MD5 2d5a194337311a18ebb5f89768ae64f0
BLAKE2b-256 120849717a53783d3aec433c5a07307561d32a7296c025417510b3eb51b9ea1d

See more details on using hashes here.

File details

Details for the file keyboard-0.7.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for keyboard-0.7.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 06a62fb7769fb5d23c48e9c18fa954c1786ea402a769be9fe3bdef8f7145cebd
MD5 ba53e3a2c0f7b409c8da0d192951ab12
BLAKE2b-256 73f6cf6139ae955b364bc516ad57364a3864a0b8994343480b2a75f081493316

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page