File size: 626 Bytes
12d535c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
import pynput
import pyarrow as pa
from dora import Node
node = Node()
def on_key_release(key):
try:
if key.char == "1":
print("Key 'm' pressed up")
node.send_output("mic_on", pa.array([]))
elif key.char == "2":
print("Key '2' pressed up")
node.send_output("cancel", pa.array([]))
elif key.char == "3":
print("Key '3' pressed up")
node.send_output("failed", pa.array([]))
elif key.char == "0":
exit()
except AttributeError:
pass
pynput.keyboard.Listener(on_release=on_key_release).run()
|