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.6.7.tar.gz (14.3 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.6.7.linux-x86_64.zip (48.5 kB view details)

Uploaded Source

keyboard-0.6.7-py2.py3-none-any.whl (20.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file keyboard-0.6.7.tar.gz.

File metadata

  • Download URL: keyboard-0.6.7.tar.gz
  • Upload date:
  • Size: 14.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for keyboard-0.6.7.tar.gz
Algorithm Hash digest
SHA256 cb675c1898fe2ebbe44e8bc9a78d39d1a39faea0bb89b8962c53869227f31548
MD5 c88d883e9aea741f9eb9a776662863dc
BLAKE2b-256 75cf2082b36fcf531d943f96ee89be6918bba08af50148a0e1706cadcd6f20ee

See more details on using hashes here.

File details

Details for the file keyboard-0.6.7.linux-x86_64.zip.

File metadata

File hashes

Hashes for keyboard-0.6.7.linux-x86_64.zip
Algorithm Hash digest
SHA256 190957239d003bf8252d6670f53435ddd4c2affa9172f64e6585eac1e6761749
MD5 2b04b6276fc07078e4ca29b092f0e735
BLAKE2b-256 5ec0bb5b6cdb88fe3725135cc16936fb8141d2ab6c5240fc59f0ae2973d5db0e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for keyboard-0.6.7-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 913b83ebafc48915d1569612b9aec48d811557dcdd5ba35ae431cf6bb9efce0b
MD5 c6629494c2af0c4254e31038168abd3d
BLAKE2b-256 755b1ec2021e2920cb9182d78b61f45f05a87275dcc04745dd5118b1c2ad184c

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