OK - got a solution here…
keyboard component should look like:
then have a code component in your typing routine with the following:
#Each frame
if len(key_resp_2.keys) > 0: #to prevent list index error
if key_resp_2.keys[len(key_resp_2.keys) - 1] == 'backspace': #allow backspacing
try: #to avoid list index errors when backspacing
key_resp_2.keys.pop(len(key_resp_2.keys)-1)
key_resp_2.keys.pop(len(key_resp_2.keys)-1)
except:
print 'no need to backspace'
elif key_resp_2.keys[len(key_resp_2.keys) - 1] == 'return': #allows return to end routine
key_resp_2.keys.pop(len(key_resp_2.keys)-1)
continueRoutine = False
#end of Routine
if key_resp_2.keys == list(corAns):
msg = 'TRUE'
trials.addData('correct', 1) #where trials is the name of the loop
trials.addData('response', ''.join(key_resp_2.keys))
else:
msg = 'FALSE'
trials.addData('correct', 0) #store for accuracy
trials.addData('response', ''.join(key_resp_2.keys)) #store full response
if you want to give feedback you can change TRUE and FALSE in the above to whatever you like and have a $msg entry in a text component in a feedback routine.
BW
Oli