OS (e.g. Win10): Win11
PsychoPy version (e.g. 1.84.x): v2024.2.1post4
Standard Standalone? (y/n) If not then what?: Yes
What are you trying to achieve?:
This is a followup to my previous thread (see previous thread here).
In my experiment the participant must click on a point on a slider scale , where there is a topic on each end. Wherever they click , the topic that is closest (for some conditions) or farthest (for one condition) on the scale get recorded for use for a later part of the experiment. the slider goes from -3 to +3, and for conditions C and HI positive ratings should result in ChoiceB and negative ratings in ChoiceA, while in condition LI it should be reversed. This all happens in the Choose_Topic_trials loop (see screenshot below)
After being recorded on a temporary list, the topics are presented in a text variable in the Agency_trials loop in the same experiment. Also being presented in the Agency_trials loop is a text blurb from an excel sheet imbeded in the loop (presented in a text component named Fact_text1).
Here are pictures for clearer understanding:
Agency_trials loop (where the routine Facts_present is located -all loops in this experiment are sequential for simplicity’s sake, and will be conterbalanced on the excel sheet instead of in psychopy itself):
Facts_present routine (you can also see the Agency_trials loop, the Choose_topic routine and the Choose_Topic_trials at the bottom) :
Excel sheet embedded in Agency_trials loop:
what it looks like on pilot with the stimuli all together (topics are top center, text blurbs in the middle):
What did you try to make it work?:
To create and store the list, in the Choose_topic routine I added a code component named “Choice_code.” I used this code for the coding component that needs to be done at the begining of the experiment:
# Initialize an empty list to store ratings
AnswerStore = []
I used this code for the coding component that needs to be done each frame:
if Type == "C":
if Choose_slider.getRating() is not None and Choose_slider.getRating() > 4:
Answer=ChoiceB
else:
Answer=ChoiceA
elif Type == "HI":
if Choose_slider.getRating() is not None and Choose_slider.getRating() > 4:
Answer=ChoiceB
else:
Answer=ChoiceA
elif Type == "LI":
if Choose_slider.getRating() is not None and Choose_slider.getRating() > 4:
Answer=ChoiceA
else:
Answer=ChoiceB
And this code at the end of the routine to save the topics onto a list:
AnswerStore.append(Answer)
In order to present the list of topics (one by one or one per trial), I added a code component in the Facts_present routine called “Answer_code”. I used this code for the coding component that should be done each frame:
AnswerStore
# Loop through each item in the list
for item in AnswerStore:
# Create a TextStim object for the current item
text_stim = visual.TextStim(win, text=item, height=0.05,pos=(-0.1,0.4), color='white')
# Draw the text and update the window
text_stim.draw()
win.flip()
# Wait for a key press to continue to the next item
event.waitKeys(keyList=['space'])
What specifically went wrong when you tried that?:
The topics are presented, and do present in the correct order (because everything in this experiment is presented sequentially), but for each presentation of the Fact blurb (presented in a text component named Fact_text1) the entire list of topics is presented twice before moving on to the text fact blurb in the trial. This gets repeated for all the trials in the loop.
I am not sure how to go on from here, or what I should do so that the items on the list are presented sequentially, one item per trial.
Thank you to everyone who has helped me solve my code issues so far. I will have to ask for your help again on this issue. Hopefully it will be smooth sailing after this is resolved ( unless something happens when i sync this experiment to Pavlovia…I will cross that bridge when I get there I guess)