Changing component status from STARTED to NOT_STARTED

Is it possible to change a component’s status from STARTED to NOT_STARTED make it appear several times during the trial without using a loop in the builder? I want to have a number of confidence rating sliders show up throughout the trial. I think the problem is that after it shows up for the first time its status changes from NOT_STARTED to STARTED and I can’t figure out how to reset it…

# *slider_confidence* updates
        if slider_confidence.status == NOT_STARTED and confidenceSlider==True:
            # keep track of start time/frame for later
            slider_confidence.frameNStart = frameN  # exact frame index
            slider_confidence.tStart = t  # local t and not account for scr refresh
            slider_confidence.tStartRefresh = tThisFlipGlobal  # on global time
            win.timeOnFlip(slider_confidence, 'tStartRefresh')  # time at next scr refresh
            # add timestamp to datafile
            thisExp.timestampOnFlip(win, 'slider_confidence.started')
        if slider_confidence.status == STARTED:
            if bool(endSlider==True):
                # keep track of stop time/frame for later
                slider_confidence.tStop = t  # not accounting for scr refresh
                slider_confidence.frameNStop = frameN  # exact frame index
                # add timestamp to datafile
                thisExp.timestampOnFlip(win, 'slider_confidence.stopped')

Hi @MRascu, after being terminated, a component has the status “FINISHED”. So it may be enough to change your first line to the following to make it “restartable”

 if (slider_confidence.status == NOT_STARTED or slider_confidence.status == FINISHED) and confidenceSlider==True:

Thank you so much for your reply!
After changing that condition the component became restartable (I can make it print something after the if condition) but it still doesn’t make the slider reappear… Maybe there’s a problem with the setAutoDraw function now?

Not sure, but here is a little example I created using the builder and some code that lets me stop and start a slider using two keys. Maybe that helps as a reference.

restart slider.psyexp (10.4 KB)
restart (11.1 KB)


Thank you!!! It works now! I think the problem is that I didn’t have this part in my code

if tThisFlipGlobal > slider_confidence.tStartRefresh + 1-frameTolerance:

as the condition for the slider_confidence.setAutoDraw(False)

I’ve been struggling with this for a week. Thank you so much!

1 Like