psychopy.org | Reference | Downloads | Github

Change outcome depending on choice

OS: Catalina
PsychoPy version: 3.2.3

I am building an experiment in which there will be 2 options on the screen to choose from: Option1 or Option2. They are always presented above or below a fixation cross (randomly)

Option1 has a 75% chance of giving no reward, whereas Option2 has a 25% chance of giving a reward.

The Option that is displayed above is chosen by pressing a button, whereas the Option that is display below is chosen by not pressing anything. How can I make it so that the program identifies the specific Option (1 or 2) that is chosen and gives a reward/no reward based on that?

I have’nt got a clue on how to go about to make this happen.

All help is much appreciated.

Start with this tutorial so your have something to build from re basic PsychoPy concepts:

Thank you. I have now figured out how to do everything except for one thing:

  1. When pressing the answer button, a circle should appear in Place1.
  2. When not pressing any button, a circle should appear in Place2.
  3. The circle should appear the last 1 second before the end of the routine.

Note that the time of the routine varies (with a code component) between 8-14 seconds.
I might be able to figure out that the circle is displayed in different places depending on if the button is pressed or not, but not sure on how to go about for the circle to appear 1 second before the end of the routine.

Any help is much appreciated.

Update:

I have tried to add this code to the “Each frame” tab in a code component:

theseKeys = event.getKeys(keyList=['space', 'None'])
if 'space' in theseKeys:
    rectChoiceUp.show = True
    rectChoiceDown.show = False
elif 'None' in theseKeys:
    rectChoiceUp.show = False
    rectChoiceDown.show = True

and the following code to the “Begin experiment” tab:

clear_keys = True

However, this leads to that both circles are displayed, instead of just one of them. It also leads to that the circles are displayed whenever ‘space’ is pressed, instead of just during a specific timeframe. Any suggestions?

Any thoughts on my approach for making this happen?