Skip to content

jenca-adam/getchlib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 )

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)

Hotkeys

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

NOTE:f.start() runs in foreground

Not interruptable

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

License

getchlib is licensed under GPL License

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages