How to reference a topic from a component in code?

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

OS (Win10):
PsychoPy version (2022.2):

Hello everyone!

I’m creating a version of Userful Field of View (UFOV) in psychopy. The task consists of presenting 24 stimuli (23 squares and a triangle, the triangle being the target with a different color. Each stimulus is presented in a different position in a compass rose with eight directions. The participant must indicate the direction that the stimulus The target appeared using the mouse On the response screen, 8 arrows are shown pointing to one of the directions and the participant sends his response by clicking in the direction he thinks the target stimulus appeared.

My difficulty is in creating a routine with feedback, but I need to compare the stimulus presented and the response emitted by the participant, and the congruence between the emission and the response is the coordinate in which the stimulus appeared.

For this I need to identify how to specify in a code component the position configured in my target stimulus. Something like:

if Target_01(Position) == Rep_Corr:
thisFeedbackT = “Correct!”
else:
thisFeedbackT = “Wrong!”

In this case Target_01 is the name of my target stimulus component and I want to reference the position in which it was configured and compare it with the response emitted by the participant.

Can someone help me?

Hi! How do you determine the position of the stimulus to begin with? It should be easy to compare the position of the stimulus (because you should know that from setting it yourself) and the arrow that it clicked.

Hello,

Thanks for the answer.

The target stimulus is randomized from 12 pre-configured coordinates in a spreadsheet.

In this worksheet I also added a column specifying the direction of each coordinate.

In the case of the arrows for issuing the response, they are configured from 8 fixed image components. That is, I’m not getting these images from a spreadsheet, but directly from the computer folder.

You probably have a mouse component in the routine and the arrows are declared as clickable, right? I think it is sufficient if you slightly change your code like so:

if mouse.clicked_name == Resp_Corr:
      thisFeedbackT = “Correct!”
else:
      thisFeedbackT = “Wrong!”

Replace “mouse” with the name of your mouse component.