psychopy.org | Reference | Downloads | Github

Trying to get PsychoPy to show an correct/incorrect message to the experimentee

OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): 3.2.3
Standard Standalone? (y/n) Think so
What are you trying to achieve?:
Trying to show an Error Message through a text box. I have managed to determine whether or the input is right/wrong and now I’m trying to get the text to show it.


This generates the string (hopefully?) ErrorMsg which I’m trying to get to print into a text component. Just not quite sure how to do this.

What did you try to make it work?:
Tried print(ErrorMsg), different variations of it with $ and ". Usually I get the same error message.

What specifically went wrong when you tried that?:
.Generating PsychoPy script…

Running: C:\Users\Student\Documents\Lloyd\Third Year\Research Paper\Experiment version 1\Experiment Version 1_lastrun.py

pygame 1.9.4
Hello from the pygame community. Contribute - pygame wiki
8.5679 WARNING User requested fullscreen with size [1368 912], but screen is actually [2736, 1824]. Using actual size
Traceback (most recent call last):
File “C:\Users\Student\Documents\Lloyd\Third Year\Research Paper\Experiment version 1\Experiment Version 1_lastrun.py”, line 469, in
CoI.setText(‘print(ErrorMsg)’)
AttributeError: ‘int’ object has no attribute ‘setText’

Think the last 5 lines or so are the most important.
Apologies if this has come up before, couldn’t find it on the forum. If there is more info you would like, please let me know.
Many thanks,
Lloyd

Hi there! maybe it’s because you didn’t add new routines accordingly.
I hope you find this useful
https://phon.wordpress.ncsu.edu/lab-manual/perception-experiments/4-psychopy-tutorial-conditional-branching/

2 Likes

Thanks for helping! In the end I realised that it should have been $Error_Msg instead of print(Error_Msg) and that I had two variables both named CoI which didn’t help.