boppreh / keyboard

Hook and simulate global keyboard events on Windows and Linux.
MIT License
3.8k stars 433 forks source link

always record 3 . #466

Open xingzhuimeteorite opened 3 years ago

xingzhuimeteorite commented 3 years ago

when i try to record key name , when catch a exception . after then, always record 3 whatever i knock any key.

shift shift shift shift G G G G g Traceback (most recent call last): File "C:\Users\gsyang\AppData\Local\Programs\Python\Python36\lib\site-packages\keyboard_generic.py", line 22, in invoke_handlers if handler(event): File "C:\Users\gsyang\AppData\Local\Programs\Python\Python36\lib\site-packages\keyboard__init__.py", line 474, in return hook(lambda e: e.event_type == KEY_UP or callback(e), suppress=suppress) File "E:\learn\python\mouse_key\record_key.py", line 33, in printcall a = record_key(keyboard._pressed_events) File "E:\learn\python\mouse_key\record_key.py", line 9, in init self.single_key_dict_code = list(key_event.keys())[0] IndexError: list index out of range 3 3 3 3 3 3 3