You need to actually tell your text stimulus to display your theseKeys
variable.
Yes, you are responsible for that now, since there is no keyboard component trying to do it automatically. e.g. something like editing the code above:
if key == 'return':
# store the response in the data file:
thisExp.addData('response', theseKeys)
# test if it was correct:
if theseKeys == corrAns:
thisExp.addData('response_correct', True)
else:
thisExp.addData('response_correct', False)
# end this trial:
continueRoutine = False
break