OS (e.g. Win10): MacOS PsychoPy version (e.g. 1.84.x): v2024.2.2 Standard Standalone? (y/n) If not then what?: y
I want the participant to have the ability to go back an iteration and redo the answer if they want. How do I go back an iteration, programatically or otherwise with a back button.
The way I do this is with concentric loops. The inner loop uses the selected rows function to select a single row from the spreadsheet, e.g. useRows = str(Idx) + ‘:’ + str(Idx+1) though useRows = [Idx] should also work. The outer loop repeats with no spreadsheet for a large number of repetitions until the value of Idx is too high and then ends with outerLoopName.finished = True
However, I believe there are timing implications with this approach since the timing for the first iteration of a loop seems to be less consistent than later iterations.
trials.rewindTrials() or trials.rewindTrials(1) will repeat the same trial
trials.rewindTrials(2) will rewind one trial (but a bug means that it can’t get back to the first trial)
trials.skipTrials() or trials.skipTrials(1) will skip a trial
trials.skipTrials(2) will skip two trials
The above code is based on a loop called trials
These functions don’t yet work online.
This behaviour will probably change in 2025 – I just tried my demo in a pre-release version and in that one you need to use trials.rewindTrials(0) to repeat a trial (no change in row number) and trials.skipTrials(2) to skip a trial (+2 to row number).
Hi @wakecarter, Thanks!!! I just checked the api and it’s exactly what I’m looking for. Can you give an example on how to get a TrialHandler2 object for the current trial?