I try to create a simple script that should be able to detect the number of time I pressed a key during an interval of time.
Code: Select all
import threading
def hello():
speech.say(str("yes " + counter2))
counter2 = 0
if starting:
speech.say("Hello world")
counter2 = 0
if keyboard.getPressed(Key.F4):
if counter2 == 0:
speech.say("Timer")
global t
t = threading.Timer(1.0, hello)
t.start()
threading.Event.wait()
counter2 = counter2 + 1