Keyboard Timeout set to a jitter
Right now I am trying to implement a jitter to my experiment but I need to keyboard to timeout in response to the jitter. In order to do this, I have used inline script to set up my keyboard. Right now I get the following error: "TypeError: keyboard() takes at least 1 argument (0 given)"
from random import randint from openexp.keyboard import keyboard #start timer t0 = clock.time() #calculate jitter length offset_time = randint(850, 1150) #initiate keyboard, set wait time to the jitter my_keyboard = keyboard(keylist=['space'], timeout=offset_time) start_time = clock.time() #get keyboard response key, end_time = my_keyboard.get_key() var.response = key var.response_time = end_time - start_time #calculate offset wait time (in case of early keypress), using the jitter t1 = clock.time() current = (t1-t0) if current < offset_time: time = offset_time-current self.sleep(int(time))