Changing the flow of the test according to the participant's reaction?

Hello everyone.

I’m a beginner in Psychopy. In my research, I show participants some photographs. I ask the participant to determine whether there is an expression of emotion in the photograph displayed on the screen. If he chooses yes, I will ask him to choose which emotion it is. However, if he chooses no, the next stimulus will appear on the screen. Is it possible for me to create a test this way where the flow changes according to the participant’s reaction?

Thanks for help.

You set your “what emotion is this” routine to end using continueRoutine = False if the response to the previous question was no.

Thank you for the answer. I tried to do as much as I could understand. However, I haven’t got any results yet.

You can see the two stages of the test I prepared below. Participants can answer the question ‘are there any expressions of emotion’ in the first stage by pressing the ‘d’ or ‘k’ button (resp1). ‘d’ means yes, ‘k’ means no. Accordingly, I added a code to the second stage and wrote it as in the photo. However, even if the ‘k’ key is pressed, the question ‘what emotion expression is this’ continues to come. I’m open to suggestions on where I might have gone wrong.

reps1 is the name of the keyboard component.

You want

if resp1.keys == 'k':

in order to check whether k was pressed in Step 1.

Also, your code should be in Begin Routine. continueRoutine = False does nothing in End Routine because the routine is already ending.

Thank you so much. It worked!