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.

API docs: https://github.com/boppreh/keyboard#api

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

  • Listen and sends keyboard events.

  • Works with Windows and Linux (requires sudo).

  • Pure Python, no C modules to be compiled.

  • Zero dependencies. Trivial to install and deploy, just copy the files.

  • Python 2 and 3.

  • Complex hotkey support (e.g. Ctrl+Shift+M, Ctrl+Space) with controllable timeout.

  • Includes high level API (e.g. `record <#keyboard.record>`__ and `play <#keyboard.play>`__, `add_abbreviation <#keyboard.add_abbreviation>`__.

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

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

  • 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'))

keyboard.press_and_release('shift+s, space')

# Blocks until you press esc.
keyboard.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.9.3.zip (48.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.9.3.win-amd64.zip (84.7 kB view details)

Uploaded Source

keyboard-0.9.3.win-amd64.exe (645.1 kB view details)

Uploaded Source

keyboard-0.9.3-py2.py3-none-any.whl (42.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file keyboard-0.9.3.zip.

File metadata

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

File hashes

Hashes for keyboard-0.9.3.zip
Algorithm Hash digest
SHA256 6032c7f35a4c4029cb345b07affde5ba2457bd623f941a5d84db8a02c0cf66da
MD5 ebd3942856ddb5f2bce604206328b0a5
BLAKE2b-256 6fbaaa8054a190e367c90b49d9b65a85892650aebb89948a5b5559ecff132953

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for keyboard-0.9.3.win-amd64.zip
Algorithm Hash digest
SHA256 aac9dca3a71b8beaef738ca30cea1e92496d4eeab844a7739a6915ac5c408459
MD5 66d385bf3b8d31847a8eacc33f8ec394
BLAKE2b-256 0686eb043ce2383717a03ae64fd21af9230fb0a3c0169464756d9a1c5d823a27

See more details on using hashes here.

File details

Details for the file keyboard-0.9.3.win-amd64.exe.

File metadata

File hashes

Hashes for keyboard-0.9.3.win-amd64.exe
Algorithm Hash digest
SHA256 d1d5e45e9368e91af043922c7b72260414ca81d62fd852dc6d46917e06ff746d
MD5 072f99f4246988c67d3eb01ca8c863cf
BLAKE2b-256 6860345b831b59cd3db0309882b35641c983b6692e1ac2cb35e3cec2f42a4a80

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for keyboard-0.9.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 ef6622fc9e8cc54e02a9988e6194a95eb13d24b9d4526770c286152c05178be3
MD5 c9f52771be178e096d27b83296636817
BLAKE2b-256 60dfba9d517aec23fd6609e39ed08b9a6b80702e15f817482515edf8caaa98d5

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