| Reference | Downloads | Github

Dot probe on psychopy builder, how to select a picture randomly from a folder to present on each side of the screen?

If this template helps then use it. If not then just delete and start from scratch.

OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): psychopy v2021. 1. 4
Standard Standalone? (y/n) If not then what?: Y
What are you trying to achieve?:
Dot probe task for attentional bias. Try to select a picture randomly from a folder to present on the left and right side of the screen.
What did you try to make it work?:
I have two types of pictures, and I put them in two folders. I want to select one randomly from each folder and present them in pairs on the screen. each folder have 30 pictures, it’s not realistic to write all conditions in a excel file because it’s much more than my trials. So I want to add some codes to make it work, but I don’t know how. Please help me, many many thanks!

What you need is independent randomisation. Have a look at my demo.

Thank you so much for your kind reply.
I already wrote all my conditions in an excel file.

I’m trying to define a variable, then I can just present a threaten picture randomly from my folder in each trial, still using other columns in my condition row.
I read your program, and I feel it will be more difficult for me =( because I need to count congruent and incongruent trials.

If you load your threat and neutral stimuli into two lists using the preload principle of my demo then you can .pop() one from the relevant list whenever you need it. Use the spreadsheet you have for the main trials loop.

For the target I would add a blank image (eg a transparent png) for the non target side.

Thank you so much!
Can you help me with the code that I can load my pictures in two lists. Can I put like "threat_list = imread(‘threat/threat1.png’, ‘threat/threat2.png’, ‘threat/threat3.png’, ‘threat/threat4.png’…) " then “threat = threat_list.pop()”.
still use $rightPicture and $rightPicture in the picture components.