Each trial select one image without repetition

Hi all,
I’m completely new to PsychoPy without any coding experience,so maybe I met some problem with coding.Please help me to achieve what I want,and I would really appreciate any sort of help!
Here is a brief introduction in detail.There are 3 conditions and each condition has 3 different images.A condition Each trial only perform one image.The outer loop can select one condition randomly from 3 conditions.The inner loop is choosing one image from the condition.My problem is how to achieve selecting image without repetition.I mean,it is random now,but also have repeating.
I have no idea whether I describe amply so that you can understand.Maybe it is quite easy,but I don’t know how to coding.
Any help will be greatly appreciated! Thank you!

Do you want each participant to see one of the three conditions or all three in random order?

Do you want each participant to see one image (for each condition) or all three in random order?

If you only want one condition then it might be easier to use a code component

Begin Experiment


Thank you for reply!@wakecarter
Each participant will see all the materials including three conditions and images both in random order without repetition.There are 9 trials in total.It’s just a tentative design,but the core problem is the same.

That’s the simplest option. No coding required.

The outer loop points to your spreadsheet containing the condition column and your inner loop points to $condition

There are two random in it,random conditions(3 conditions) and random images(each condition including 3 images).For instance,a1,a2,a3,b1,b2,b3,c1,c2,c3,and I want them to perform like this:a1,b2,c1/a3,b1,c2/a2,b3,c3.I’m sorry I forgot to tell a step which I learned from reply of the preceding question in this site.In the End routine tab,I added the coding:trials.finished = True.
As you said that,I have already done before.But it is possible to select the same image like a1,b3,c2/a1,b2,c1…
Thank you for being patient.

I’m sorry if I didn’t understand your design.

So you want the conditions to be in random order and then repeat. However, I would probably recommend a variation on my code for interleaving lists.

:smile:Maybe my poor expression confused you.There is a long way to go for learning PsychoPy.If you don’t mind,I want to ask you some experience about it.For instance,can you introduce some learning resources about PsychoPy,is it the official website or something else,and some suggestion for beginner?
Thank you again!

There are lots of resources. I have PsychoPy Primer slides on my VESPR website

However, there are also some links here Resources (e.g. for teaching) — PsychoPy v2021.1

Thanks a lot.
After the discussion with my tutor,I got a new problem now.There is a block including 300 trials performed randomly.So I want to add a break after each 60 trials.Can you help me please?

Have a counter (e.g. loopIdx) and then add the following to Begin Routine in your break rountine

loopIdx +=1
if loopIdx%60!=0:

I can understand what you said,but I don’t know how to add a counter.The error shows that the variable is not defined.I replaced loopIdx with trial.thisN,and it still didn’t respond.

Put loopIdx=-1 in Begin Experiment

Excellent! The procedure can run successfully.
I put the break routine after the test routine which consists of 300 trials.But I want to perform the End of Experiment after the last group rather than Have a Rest.What should I do next?
I really appreciate the help you gave me.My first PsychoPy procedure is almost done with you help.Thank you again.

If you start loopIdx at 0 instead of -1 you should skip the pause on the first loop.

If you add “and loopIdx != 300 to the if statement then you’ll skip the one at 300

:clap:Sincerely appreciate.