0

I'd like to control a game with the arrow keys and stumbled upon keyboard.read_hotkey() from keyboard. Unfortunately, this method does not seem to work. Even worse, it seems to crash my system (Windows 10). Here is a minimal example:

accepting = True
while accepting:
    if keyboard.read_hotkey() == 'enter':
        accepting = False
    elif keyboard.read_hotkey() == 'space':
        print('Done.')

Try pressing the space bar several times or executing this from a IPython cell repeatedly. For me, this causes the left mouse button to get stuck permanently so that when I click e.g. two desktop icons, a rectangular selection happens and both icons remain selected. I can even click into different parts of a text file and a non-blinking line cursor ('|') will stay wherever I clicked. Is there something wrong with my code or is this an issue with this package?

0 Answers0