Skip to content

accessibleapps/keyboard_handler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

Keyboard Handler allows you to register global hotkeys on multiple platforms, in addition to implementing a flexible parsing system.

WXKeyboardHandler

This can be used in an WX application:

Initializing the handler

from keyboard_handler.wx_handler import WXKeyboardHandler
handler = WXKeyboardHandler(parent)

Registering a global hotkey

try:
	key = handler.register_key(key, function)
except keyboard_handler.KeyboardHandlerError:
	handle parse error

Keys can be parsed in a human-readable format, perfect for config files.

handler.register_key("control+t", self.display_time)
handler.register_key("control+windows+w", self.do_something_else)

You can register keys in bulk given a mapping.

mapping = {"control+w": self.close_window, "alt+f4": self.close_all}
handler.register_keys(mapping)

Unregistering a global hotkey

handler.unregister_key("control+t", self.display_time)
handler.unregister_key("control+windows+w", self.do_something_else)

or to unregister a mapping:

mapping = {"control+w": self.close_window, "alt+f4": self.close_all}
handler.unregister_keys(mapping)

or to unregister everything:

handler.unregister_all_keys()

About

easily parse and register hotkeys on multiple platforms

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages