Skip to main content

VERSION

DOWNLOADS

TESTS

COVERAGE

Latest PyPI version

Number of PyPI downloads

Travis results

Coveralls results_

Library to easily read single chars and key strokes.

Goal and Philosophy

Born as a python-inquirer requirement.

The idea is to have a portable way to read single characters and key-strokes.

Documentation

Installation

pip install readchar

The readchar library is compatible with python 2.6, 2.7, 3.2 and 3.3.

Usage

Usage example:

import readchar

c = readchar.readchar()
key = readchar.readkey()

API

There are just two methods:

readchar()

Reads the next char from stdin, returning it as a string with length 1.

readkey()

Reads the next key-stroke from stdin, returning it as an string.

A key-stroke can have:

  • 1 character for normal keys: ‘a’, ‘z’, ‘9’…

  • 2 characters for combinations with ALT: ALT+A, …

  • 3 characters for cursors: ->, <-, …

  • 4 characters for combinations with CTRL and ALT: CTRL+ALT+SUPR, …

There is a list of previously captured chars with their names in readchar.key, in order to be used in comparations and so on. This list is not enough tested and it can have mistakes, so use it carefully. Please, report them if found.

SO Support

Sadly, this library has only being probed in GNU/Linux. Please, if you can try it in another SO and find a bug, put an issue or send the pull-request.

Thank you!

License

Copyright (c) 2014 Miguel Ángel García (@magmax9).

Based on previous work on gist getch()-like unbuffered character reading from stdin on both Windows and Unix (Python recipe), started by Danny Yoo.

Licensed under the MIT license.

Metadata

Release files for readchar 0.2-test1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for readchar 0.2-test1
File Size Uploaded Provenance Actions
readchar-0.2-test1.tar.gz 4.4 kB Without provenance Details for readchar-0.2-test1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for readchar 0.2-test1
File Interpreter ABI Platform Actions
readchar-0.2-test1.linux-i686.tar.gz Details for readchar-0.2-test1.linux-i686.tar.gz

Total release size: 10.9 kB

Release files / readchar-0.2-test1.tar.gz

Download URL readchar-0.2-test1.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
43d062bfb1fb3fadcd15cf8f9459a0d0d0bf899c9b2e78500acb0b68d00c0ad5
BLAKE2b-256 checksum
How to use checksums
16e6e9a0143e3d396be13587323c9bb7bc2d3f4001c1b9468e8d3dbe046c3393
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / readchar-0.2-test1.linux-i686.tar.gz

Download URL readchar-0.2-test1.linux-i686.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8bc7b3b47f01c6100eef5d27fa479089fcbe4ca96f03dc31031566e86b114d6a
BLAKE2b-256 checksum
How to use checksums
558a344c545de52e72f039ec8a4d486e7aa6373920f5e1e0cb19b34e25bb22e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for readchar 0.2-test1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

0.0.1

This release

0.2-test1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page