forked from balicaf/TiresiasProject
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkey.py
More file actions
34 lines (26 loc) · 772 Bytes
/
key.py
File metadata and controls
34 lines (26 loc) · 772 Bytes
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
29
30
31
32
33
34
import Queue
import keyboard
import string
import time
from threading import *
# I can't find a complete list of keyboard keys, so this will have to do:
keys = list(string.printable[0:36])
## keyboard don't support complexe carractere
def listen(key,q):
while True:
keyboard.wait(key)
a = key
print "listen : ",a
q.put(a)
print "exit loop"
q.put(None)
def startKeyboard():
threads = [Thread(target=listen, kwargs={"key":key,"q":queue}) for key in keys]
for thread in threads:
thread.start()
queue = Queue.Queue()
threads = [Thread(target=listen, kwargs={"key":key,"q":queue}) for key in keys]
startKeyboard()
#for thread in threads:
# thread.start()
#threads.start()