Skip to main content

Library for reading key presses

Project description

getchlib - library for reading key presses

Overview

getchlib is library for reading key presses and assigning hotkeys.

Features

  1. Full Unicode support
  2. Blocking and non-blocking key press reading
  3. Cross-platform support
  4. Basic hotkeys ( CTRL-V or ALT-A ) are defined
  5. Not interruptable key press reading support ( cannot be interrupted by CTRL-C, returns key code instead )
  6. Keys like arrow up, arrow left, arrow down, arrow right are defined (for full list, view getchlib.keynames.raw)

Installation

pip install getchlib

Usage

Key Presses

Blocking

import getchlib
key=getchlib.getkey()

Waits until user presses a key.

Non-Blocking

import getchlib
key=getchlib.getkey(False)

Returns first key pressed in time specified by its second argument tout ( 0.01 by default ).

Not interruptable

import getchlib
key=getchlib.getkey(catch=True)

Echo argument (new in v1.0.3)

With echo=True characters readed are echoed to the screen.

key=getchlib.getkey(echo=True)

Hotkeys

import getchlib
def function():
	print('hello')
f=getchlib.HotKeyListener()
f.add_hotkey('ctrl-x',function)
f.start()

Not interruptable

import getchlib
def function():
	print('hello')
f=getchlib.HotKeyListener(catch=True)
f.add_hotkey('a',function)
f.start()

Non-blocking (linux only)

import getchlib
def function():
	print('hello')
f=getchlib.HotKeyListener(catch=True)
f.add_hotkey('a',function)
...
f.terminate()

License

getchlib is licensed under GPL License

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

getchlib-1.1.3.tar.gz (205.0 kB view details)

Uploaded Source

Built Distribution

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

getchlib-1.1.3-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file getchlib-1.1.3.tar.gz.

File metadata

  • Download URL: getchlib-1.1.3.tar.gz
  • Upload date:
  • Size: 205.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for getchlib-1.1.3.tar.gz
Algorithm Hash digest
SHA256 0883ad2050b76272941096879401ae827e1fb7340af787a93e0e5136e32b37a7
MD5 6f75fd7550354107c0e32ee38084fd96
BLAKE2b-256 6174653205bb237ab4374c8f245ff506a79b3a2a6480b6ae4fe82bcdf30dcb39

See more details on using hashes here.

File details

Details for the file getchlib-1.1.3-py3-none-any.whl.

File metadata

  • Download URL: getchlib-1.1.3-py3-none-any.whl
  • Upload date:
  • Size: 13.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for getchlib-1.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 932b1b1e0f5122dd2050bbb312b9b0ecd39a1ff0b7065c46c7526e4ade2e5c03
MD5 cafea253047c27c1abfefb2b57052bd4
BLAKE2b-256 be10de0ce0c1de3eec73f7b0245150771a26d2831b759ad749d4d007e7fecd98

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