did you define the correct answer somewhere? I guess so because you use corrAns in our if-construction. In this case you could simplify your if-construction. trial_resp.corr contains 1 or 0 for correct or incorrect answers. It evaluates to true or false in an if-construction depending on your corrAns.
You can also check key_resp.keys. If your participants did not answer, key_resp.keys evaluates in an if-construction to false. So combing everything it boils down to
msg = "correct"
msg = "wrong"
msg = "no answer"
You could add your triggers and code to the appropriate branch of the if-construction.
In the example I used the “standard” name PsychoPy comes up with when using the keyboard-component. You need to adapt that to your component-names.
I was going to ask a similar question. Your issue might be with the value of responded.
You can check with print(‘responded’,responded)
Also, you are using elif with no else conditions. If responded is supposed to be 1 or 0 then you can use else: instead of elif responded == 0: (which would mean that your code would work if responded was, for example, switching between 1 and undefined)
@wakecarter Thanbk you. I guess I’’ try a the way that you suggested too. I was also wondering whether by specifying better the difference from correct responses conditions (!= corrAns) - possibly by adding an and statement such as and trial_resp.keys == None in one of the statements of the if-loop, this might make work everything.