AFAIK, you can’t or you shouldn’t have two keyboard-components in one routine.
You could use one keyboard-component, check whether two keypresses have taken place, end the routine, and finally check for the proper order of the answers and the number of responses given.
First of all, I changed my settings so that I store all of the entered keyboard responses and not just the last one. I still don’t know why my original code didn’t work. Weird. I would still appreciate suggestions about why this happened.
Now I get a list with keyboard inputs (that is where the len is). I have to change my code so that there will be also a feedback when too many keys are pressed (otherwise the participants could just press every key all the time to get the right answer)
For the right or wrong order I compared the last entered key (that’s where the [-1] is)
if ( \
key_resp_t1.keys is None \
and len(key_resp_t2.rt) > 0
) or ( \
len(key_resp_t1.rt) > 0 \
and len(key_resp_t2.rt) > 0 \
and key_resp_t2.rt[-1] < key_resp_t1.rt[-1] \
):
msg = 'Wrong order'
elif key_resp_t1.keys is None \
or key_resp_t2.keys is None:
msg = 'Too slow'
elif len(key_resp_t1.keys) > 1 \
or len(key_resp_t2.keys) > 1:
msg = 'Too many keys were pressed'
elif key_resp_t1.keys == [t1_resp_corr] \
and key_resp_t2.keys == [t2_resp_corr]:
msg = 'Right'
else:
msg = 'Wrong'
Thanks for letting me know. After spending literal hours on my code I could make it work with two keyboard components. However, this was such a pita. I will restart the project and try to program it with just one keyboard component. After all, this was just an exercise to learn PsychoPy and I want to learn it the right way and not the wrong and complicated way.