psychopy.org | Reference | Downloads | Github

Failing to display a number from selection?


#1

OS : Win 10
PsychoPy version (e.g. 1.84.x): 1.85.1

What are you trying to achieve?:

I am running an experiment where the participants have a number to tries to sample from two options. Once they have chosen an option they will receive a reward from that option’s list. While previously I had the remaining samples as images lined up at the top of the screen this made the whole experiment very slow.
What I am trying now to do is display the number of remaining samples as text at the top of the screen.
The number of samples available should randomly start at 9, 11, 14, 17, 20 and then reduce by one every time either the left or right option is chosen.

What did you try to make it work?:


Begin Experiment

Samples_num = dataframe['Samples'].tolist()

Begin routine

Samples_num = random.choice(Samples)

Each routine


>if not Samples_num > 0:
    print Samples_num
    continueRoutine=False
if event.getKeys('left'):
    Samples_num = Samples_num-1
    score = random.choice(list1)
    reward_message = "Win-"+str(score)
    print reward_message

For the text stimuli I input
>$str(Samples_num)+""

What specifically went wrong when you tried that?:
Currently I get the message

Does anyone know how I can do this?