Is there any way to identify two keyboards separately?

463 Views Asked by At

I've used the keyboard module in python to identify a keypress event as shown below.

import keyboard

while True:
    if keyboard.read_key() == "k":
        print("You pressed k")
        break

Now I have 2 keyboards and I want to identify the keyboard used to press the key (Something like below).

import keyboard

while True:
    if 'k' of keyboard 1 pressed:
        print("You pressed k of keyboard 1")
        break
    if 'k' of keyboard 2 is pressed:
        print("You pressed k of keyboard 2")
        break

Can I do this with the keyboard module? If not is there any other way to do this in python?

0

There are 0 best solutions below