# Feedback is always Incorrect

**URL:** <https://discourse.psychopy.org/t/feedback-is-always-incorrect/15136>\
**Category:** Builder\
**Created:** [July 18, 2020, 1:31pm UTC](https://discourse.psychopy.org/t/feedback-is-always-incorrect/15136 "2020-07-18T13:31:37Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![triptiverma](https://avatars.discourse-cdn.com/v4/letter/t/a9adbd/32.png) [@triptiverma](https://discourse.psychopy.org/u/triptiverma)\
**Post date:** [July 18, 2020, 1:31pm UTC](https://discourse.psychopy.org/t/feedback-is-always-incorrect/15136/1 "2020-07-18T13:31:37Z")

</div>

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

OS: Win10  
PsychoPy version: 3.2.4  
**What are you trying to achieve?:**  
I am designing a cued switching task for children, where they have to sort some toys based on their color or shape. The outline of the experiment is as follows:  
There will be four stimuli: Red Bear, Blue Bear, Red Car, and Blue Car.  
If the cue is for color, participants have to select either blue or red color, whereas if the cue is for shape, they have to select either bear or car. So, there are four response options: A=Blue, S=Red, K=Bear, L=Car.  
The problem I am facing is that I have to provide feedback after each trial, but the feedback appears to be INCORRECT, no matter what the response is. Also in the data file, resp.corr is always zero.

**What did you try to make it work?:**  
I tried to provide feedback by putting the code as given in: [https://www.psychopy.org/recipes/builderFeedback.html](https://www.psychopy.org/recipes/builderFeedback.html)

**What specifically went wrong when you tried that?:**  
The displayed feedback is always INCORRECT and in the data file resp.corr is always zero.

Please help me find out the problem and solve it.

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [July 19, 2020, 9:30am UTC](https://discourse.psychopy.org/t/feedback-is-always-incorrect/15136/2 "2020-07-19T09:30:25Z")

</div>

What do you have as the correct answers?

If your answers are in upper case they won’t match the key presses

---

<div class="post-metadata">

**Author:** ![triptiverma](https://avatars.discourse-cdn.com/v4/letter/t/a9adbd/32.png) [@triptiverma](https://discourse.psychopy.org/u/triptiverma)\
**Post date:** [July 19, 2020, 10:07am UTC](https://discourse.psychopy.org/t/feedback-is-always-incorrect/15136/3 "2020-07-19T10:07:33Z")

</div>

Thank you for your response. I checked the answers, they were indeed in capital letters. I changed them into small letters as I have entered in the experiment design. Even after changing them to small letters, resp.corr is still zero.  
In one of the topics on this forum similar problem was mentioned. I tried to add that code as well as given in that topic but it didn’t work.

> [@Feedback depending on correctness of answer inside a trial](https://discourse.psychopy.org/t/feedback-depending-on-correctness-of-answer-inside-a-trial/5747):
>
> Hi everyone, What are you trying to achieve?: I am programming an IAT, where participants have to categorize stimuli (left vs right). Here is a simplified version of the experiment so there is only the relevant stuff. My goal is the following : if the participant answers correctly, the experiment must continue to the next trial. if they answer incorrectly, feedback appears (eg: a red cross), and they should correct their answer by hitting the other key. My dependent variables will be the RT…

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [July 19, 2020, 10:15am UTC](https://discourse.psychopy.org/t/feedback-is-always-incorrect/15136/4 "2020-07-19T10:15:14Z")

</div>

Please could you post your current code and the keyboard component?

---

<div class="post-metadata">

**Author:** ![triptiverma](https://avatars.discourse-cdn.com/v4/letter/t/a9adbd/32.png) [@triptiverma](https://discourse.psychopy.org/u/triptiverma)\
**Post date:** [July 19, 2020, 10:54am UTC](https://discourse.psychopy.org/t/feedback-is-always-incorrect/15136/5 "2020-07-19T10:54:32Z")

</div>

![RespPIC_D properties](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/6/7/67e8335d313de414b55a27ce292ac29f72ebf968.png)  
This is the keyboard settings.  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/1/7/172d2a1cf1de57d5693ec6fda966cca2a1b3b1b4.png)  
This is the code I wrote using this link: [Feedback depending on correctness of answer inside a trial](https://discourse.psychopy.org/t/feedback-depending-on-correctness-of-answer-inside-a-trial/5747)  
 ![code_4 properties2](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/6/8/68da3c77b7d50398ba1ad686f1ed6247be795c16.png)

---

<div class="post-metadata">

**Author:** ![Michael](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/michael/32/16_2.png) [@Michael](https://discourse.psychopy.org/u/Michael)\
**Post date:** [July 19, 2020, 11:19am UTC](https://discourse.psychopy.org/t/feedback-is-always-incorrect/15136/6 "2020-07-19T11:19:13Z")

</div>

- Your code runs at the beginning of the routine. No response has been made at that point, as the trial hasn’t started, so your message will always be set to “incorrect”.
- Delete the first six lines of your code. Even if this code was running in the “each frame” tab, it would just be duplicating the function of the keyboard component itself, so it is not needed.
- I’m guessing that the last four lines of your code could be retained but should be shifted to the “end routine” tab, if it is designed to set the text feedback on the next routine in the flow panel.

---

<div class="post-metadata">

**Author:** ![triptiverma](https://avatars.discourse-cdn.com/v4/letter/t/a9adbd/32.png) [@triptiverma](https://discourse.psychopy.org/u/triptiverma)\
**Post date:** [July 20, 2020, 6:29am UTC](https://discourse.psychopy.org/t/feedback-is-always-incorrect/15136/7 "2020-07-20T06:29:23Z")

</div>

I deleted the first six lines of the code and shifted the remaining code to the “end routine” tab. Still the problem persists.

---

<div class="post-metadata">

**Author:** ![Michael](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/michael/32/16_2.png) [@Michael](https://discourse.psychopy.org/u/Michael)\
**Post date:** [July 20, 2020, 11:17am UTC](https://discourse.psychopy.org/t/feedback-is-always-incorrect/15136/8 "2020-07-20T11:17:56Z")

</div>

You should also tell the keyboard component to store just one response, rather than all of them (I’m not at my computer at the moment so am not sure how PsychoPy could judge correctness if more than one response is allowed).

---

<div class="post-metadata">

**Author:** ![triptiverma](https://avatars.discourse-cdn.com/v4/letter/t/a9adbd/32.png) [@triptiverma](https://discourse.psychopy.org/u/triptiverma)\
**Post date:** [July 23, 2020, 5:42am UTC](https://discourse.psychopy.org/t/feedback-is-always-incorrect/15136/9 "2020-07-23T05:42:34Z")

</div>

It finally worked. Thank you for your help.

---

<div class="post-metadata">

**Author:** ![triptiverma](https://avatars.discourse-cdn.com/v4/letter/t/a9adbd/32.png) [@triptiverma](https://discourse.psychopy.org/u/triptiverma)\
**Post date:** [August 23, 2020, 9:39am UTC](https://discourse.psychopy.org/t/feedback-is-always-incorrect/15136/10 "2020-08-23T09:39:43Z")

</div>

The issue is regarding the same experiment. Now I am trying to run the same experiment using a touchscreen laptop. The outline of the experiment is the same. The target screen will have a target picture (Red Bear, Blue Bear, Red Car, Blue Car) at the center and four response options (Red color patch, Blue color patch, Bear drawing, Car drawing) below the target. Based on the given cue, the participant (in my case children) will have to respond by touching the appropriate response picture on the screen.

With the help of the discourse earlier: [Using the mouse for selecting images](https://discourse.psychopy.org/t/using-the-mouse-for-selecting-images/876) I tried to write a code as follows:  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/b/a/bafe5af32a70c3bf73ef758f76eb0137f2fd5b07.png)

and the mouse component as follows:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/e/1/e1f8873d30dcc0a28a5ef0009394c6c1dabccc3d.png)

After this, in my data file I am not getting which picture has been clicked. Since, there are correct and incorrect responses, I wanted to have a column as before which stated whether the answer was correct or not by giving ‘1’ or ‘0’ in the column. This also is not shown in the data file.  
I also wanted to provide feedback to the participant by highlighting the selected picture in either red or green color, based on whether the response was correct.  
Please help me solving this issue.

Thank You

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [August 27, 2020, 10:26pm UTC](https://discourse.psychopy.org/t/feedback-is-always-incorrect/15136/11 "2020-08-27T22:26:31Z")

</div>

Use the .contains method and put the code in End Routine

---

<div class="post-metadata">

**Author:** ![triptiverma](https://avatars.discourse-cdn.com/v4/letter/t/a9adbd/32.png) [@triptiverma](https://discourse.psychopy.org/u/triptiverma)\
**Post date:** [August 29, 2020, 7:36am UTC](https://discourse.psychopy.org/t/feedback-is-always-incorrect/15136/12 "2020-08-29T07:36:18Z")

</div>

Thank you for your response. I had a confusion with .contains() method.  
The following code was suggested in this discourse: [Writing contains(mouse) to output](https://discourse.psychopy.org/t/writing-contains-mouse-to-output/4808)

# this list should could just be created once per trial, in the ‘begin routine’ tab:

stimuli = [topLeftImg, topRightImg, bottomRightImg, bottomLeftImg]

# and this run on every frame:

for stimulus in stimuli:  
if stimulus.contains(mouse) and stimulus.name == corrAns:  
thisExp.addData(‘clicked\_stimulus’, stimulus.name)  
continueRoutine = False  
break # end the loop on first click

Here, what will “mouse” denote? Sorry for asking silly questions, but I am not very familiar with coding so I keep getting confused with variable names to be put in the code. Also, I have four response options. So, do I have to write for loop for each response option?

Thank You

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [August 29, 2020, 1:28pm UTC](https://discourse.psychopy.org/t/feedback-is-always-incorrect/15136/13 "2020-08-29T13:28:40Z")

</div>

I create a mouse component in my first routine called mouse. I can then use it in code in all future components.
