The piece of code below is used for people to type in their responses (borrowed from one of the pilot demos). It’s in an ‘Each Frame’ element
I’ve added the line 'thisExp.addData(‘word_complete_time’, t) in order to get the time at which the participant hits ‘Enter’. However, I’m having difficulty in putting in some code that works to capture the time at which the participant started typing (i.e. I’m experiencing the issue that every time the Frame loops around it constantly updates any keyboard response timings to the next letter and the letter after that etc etc). Any ideas on what I should add would be appreciated thanks.
keys = event.getKeys()
if len(keys):
if 'space' in keys:
text.text = text.text + ' '
elif 'backspace' in keys:
text.text = text.text[:-1]
elif 'lshift' in keys or 'rshift' in keys:
modify = True
elif 'return' in keys:
thisExp.addData('word_complete_time', t)
continueRoutine = False
else:
if modify:
text.text = text.text + keys[0].upper()
modify = False
else:
text.text = text.text + keys[0]