End Screen / Goodbye / Thank you for participating

Hello,

I am Brand New to Python and Psychopy so please use simple language!
I have managed to create a simple keyboard response task, and yet I have fallen at the final hurdle!

How do I add text at the end of my task to say “Thank you for participating, goodbye!” or something of a similar nature. I also want this to appear on screen for 1.5 seconds. Nothing fancy.

I realise this is basic beyond basic but I can’t find anything else online to tell me how to do this.

Many thanks,
Raegan :slight_smile:

Really depends how the rest of your experiment is put together (show us the code if you want specific advice), but the short version is, after whatever your main experiment loop is, just create a textStim object, draw it, flip your window, and put core.wait(1.5)

Hi Jonathan,

Thank you so much for your reply. I have no idea what you mean by TextStim object?

This is my code:

from psychopy import visual, event, core
from psychopy.visual import ShapeStim

win = visual.Window([800,800])

stimBlue = visual.Circle(win,radius=0.2,edges=64, fillColorSpace=‘rgb255’, fillColor=[0,0,255])
stimRed = visual.Circle(win,radius=0.2,edges=64, fillColorSpace=‘rgb255’, fillColor=[255,0,0]) #T1
stimBlue.pos = [-0.6,0]
stimRed.pos = [0.6,0]

feedback = visual.TextStim(win, colorSpace = ‘rgb255’, color=[0,0,0]) # this creates some text

for i in range(1,10): # T3 This command controls the index, this changes by a value of 1 within its range
if i % 2 == 1: # if the trial is an odd number (note - % means “modulus”)
stimOn = 'blue’
stimBlue.draw()
if i % 2 == 0:
stimOn = 'red’
stimRed.draw() #T4

win.flip() # T5 The flip command tells Psychopy we want to present something inside the window we previously set out
key = event.waitKeys(maxWait=5,keyList=['b','r']) # waits for either an r or b key to be pressed. If 5 seconds pass, then it moves on without a response

if key == ['b'] and stimOn == 'blue': # if the key pressed was b and the stimulus presented was blue
    feedback.text = "Correct!"
elif key == ['r'] and stimOn == 'red': # if the key pressed was r and the stimulus presented was red
    feedback.text = "Correct!"
else: # T6
    feedback.text = "Too long!"
if key == ['r'] and stimOn == 'blue':
    feedback.text = 'Incorrect!'
elif key == ['b'] and stimOn == 'red':
    feedback.text = 'Incorrect!'
feedback.draw()
win.flip()
core.wait(1.5)
win.flip()
core.wait(1)

Many thanks :slight_smile:

@RaeganWhitehead, you could add another routine to the flow at the end of your experiment, and use a text component to give your thank you msg. See attached as a basic example:
thanksDemo.psyexp (6.8 KB)

Hello,

Thank you very much for your help! That file is in Builder view and I don’t know how to view the code behind it?

Sorry!

Raegan :slight_smile:

Hi @RaeganWhitehead. In Builder view, there is an icon that looks like a piece of paper and pen. That is the compile script button, which will output the builder script to the coder view. If you want a quick tutorial on using builder to build an experiment, like the Stroop task, you can watch this tutorial on YouTube if you click here

Hi!

It isn’t letting me view that as its a restricted file? Nevermind, my coursework is due at 12 midday so I have put an annotation to say I couldn’t do that last bit!

Thank you very much for your help and I am sure I’ll be back on here when it comes to designing the programme for my dissertation, which is funnily enough a stroop task!

Many thanks, Raegan :slight_smile:

@RaeganWhitehead Well if it’s for a class project I won’t outright give you the answer, but you already have the tools here to do it. A “TextStim object” is what you make with a statement like “x = visual.TextStim”. “feedback” in your code is a TextStim object for example. stimBlue and stimRed are Circle objects. They’re called “objects” because they are self-contained entities with a collection of properties and functions (and are the essential feature of “object-oriented programming”, which encompasses Python, C++, and just about any other “serious” programming language).

So, all you need to do is, at the very end of your code (after the for loop), make a new textstim object (or change the feedback text to “all done”), draw it, flip your window, and put core.wait(1.5). It’s exactly the same as how you’re presenting the feedback now, you just put it after the loop is done.