Browse Source

Add main function into dora-leyboard

tags/v0.3.6
haixuanTao 1 year ago
parent
commit
fbe3f98af3
1 changed files with 11 additions and 8 deletions
  1. +11
    -8
      node-hub/dora-keyboard/dora_keyboard/main.py

+ 11
- 8
node-hub/dora-keyboard/dora_keyboard/main.py View File

@@ -4,13 +4,16 @@ import pyarrow as pa
from dora import Node


node = Node()
def main():
node = Node()
with keyboard.Events() as events:
while True:
event = events.get(1.0)
if event is not None and isinstance(event, Events.Press):
if hasattr(event.key, "char"):
if event.key.char is not None:
node.send_output("char", pa.array([event.key.char]))


with keyboard.Events() as events:
while True:
event = events.get(1.0)
if event is not None and isinstance(event, Events.Press):
if hasattr(event.key, "char"):
if event.key.char is not None:
node.send_output("char", pa.array([event.key.char]))
if __name__ == "__main__":
main()

Loading…
Cancel
Save