def get_translation_dicts(self):
"""
Returns dictionaries for the translation of keysyms to strings and from
strings to keysyms.
"""
keysym_to_string_dict = {}
string_to_keysym_dict = {}
#XK loads latin1 and miscellany on its own; load latin2-4 and greek
Xlib.XK.load_keysym_group('latin2')
Xlib.XK.load_keysym_group('latin3')
Xlib.XK.load_keysym_group('latin4')
Xlib.XK.load_keysym_group('greek')
#Make a standard dict and the inverted dict
for string, keysym in Xlib.XK.__dict__.items():
if string.startswith('XK_'):
string_to_keysym_dict[string[3:]] = keysym
keysym_to_string_dict[keysym] = string[3:]
return keysym_to_string_dict, string_to_keysym_dict
评论列表
文章目录