| Reference | Downloads | Github

Displaying Text Stim Conditional Response

OS: Win10
PsychoPy version: 2020.1.2

Hi there! I am attempting to display the correct data from a spreadsheet based on prior responses in psychopy, but I am running into some difficulty.

Basically, I am having people select their sex and race at the beginning of the experiment using sliders and would like to display all of the values from a column based on their responses. Here is the structure of the experiment so far and an explanation of the problem I’m running into.

There is an initial routine that includes 2 sliders - “sex” and “race” - with three options for “sex” and four for “race”. Next I have a routine with a loop around it. The loop calls in a spreadsheet that has a set of values for each combination of sex and race (so 12 columns total). Inside of the routine I tried a couple of options, and landed on creating 12 separate text stims with a conditional start statement for each (i.e., for the “male_white” text stim, the conditional start is “sex.getRating() is 1 and race.getRating() is 1” because male on the slider is set to 1 and white on the slider is set to 1). Then the text is set to the correct column from the excel file for the sex/race combination in the conditional. The duration for each text stim is set to 3 seconds.

When I try running the experiment, I am able to get the correct value to appear for the first item in the loop, but then the experiment won’t continue to the next routine in the loop (a fixation cross) and just goes blank after 3 seconds. I assume this is because of the conditional statement not initializing for the 11 other text stims.

Is it possible to get this to work? Is there a better way to do this?

Hi all,
Just in case someone else is working on something similar, I was able to work around this by entering the following code into a code component under “Each Frame” at the end of the routine:

for thisComponent in practice_feedbackComponents:
if hasattr(thisComponent, “status”) and thisComponent.status != FINISHED and t >= 3:
continueRoutine = False

Hope this helps someone else!

Also, if anyone has any thoughts about how to alternatively program this to be more clean, I’m very interested to hear someone’s thoughts on this.