keyboard icon indicating copy to clipboard operation
keyboard copied to clipboard

Cannot use scan codes to make key combinations

Open JimmyLienert opened this issue 3 years ago • 1 comments

I am unable to use scan codes to make key combinations. I find scan codes easiest to use because some of the key names are confusing and there seems to be some overlay. However, when I try to use scan codes to make key combinations, e.g. I want keyboard.is_pressed(59+2) to make the key combination f1 and 1, it just adds the numbers, making this example result in the single key f3. I think a good solution to this issue would be to replace the plus for combinations with &, which is not used for anything in python and should not cause any issues.

JimmyLienert avatar Aug 11 '21 20:08 JimmyLienert

Just use this.

import keyboard

def your_function(args):
    # some code

keyboard.hotkey("59+2", your_function)
keyboard.wait()

SpikeVN avatar Aug 12 '21 07:08 SpikeVN