I am a PsychoPy & Python newbie.I am making an experiment where participants answer several questions. Before they will enter their answers, I’d like participants to have the option (but not the requirement) of getting another participant’s answer (called “advice”). In other words, if participants choose to get the answer, the answer will be shown on the screen. If not, the answer will not be presented.
To the end, I created a text component (named by “AdviceSelection”) in the builder and then set the opacity = 0 (constant). Next, I put the code component that if the participant enter “y” key, the opacity of the AdviceSelection text component will change 1 after 2 seconds.
The problem that I face is that the AdviceSelection text stimulus already shown is still shown after the routine. What I mean is that the text stimulus do not disappear at the next routine. You can see how it is messy in the attached file.
I want to know how to reset the opacity of the AdviceSelection text stimulus 0 again at the end of the routine (before moving to the next routine). I tried to put some codes indicating that if the participants entered their answer, the exact same text stimulus but white color will be presented at the same location. I thought it would cover up the already-shown text stimulus because the background color is white. But it does not cover up perfectly. I read through all of the discussions with regard to “opacity” on this website. I cannot solve this issue because of my lack of programming knowledge.
I wrote down my codes below and attached the psycopi file.
PsycoPI.psyexp (15 KB)
(The following code is written in the Each Frame. The code component in the Builder is located just above the text component called “AdviceSelection.”)
if event.getKeys('y'): # if y key pushed, import time time.sleep(2) thisExp.addData('Adviceseeking', 'yes') AdviceSelection = visual.TextStim(win=win, name='AdviceSelection', text=u'The estimate of advisor # 34 is: 75', font=u'Arial', pos=(0, 0.0), height=0.06, wrapWidth=None, ori=0, color=u'Black', colorSpace='rgb', opacity=1, depth=-4.0)