psychopy.org | Reference | Downloads | Github

How can I make text as a clickable object?

I show several letters and I need to know which letter was selected with the mouse clic. Is this possible?

My version is 3.2.4, thanks!

@andreamorag, yes text is a clickable object. To do this in Builder:

  • Create your text object, e.g., called myText
  • Add a mouse object
  • Add myText as a clickable stimuli in the mouse component dialog

If you want to end the trial on valid clicks (clicks on your clickable stimuli), then select “valid clicks” as the method of ending the routine, in the mouse component. See mouse docs .

Thanks for your reply David!

Indeed I have a text object and a mouse object. In fact my text object is link to my conditions file (xlsx) because the letters change every trial. But how can I know if I show three letters (b d and k) which letter the person clicked? In this moment the program only retrieve the three letters (b d and k) but I need to know which one was selected.

Thanks in advance for all your help!

For three separate letters, you are better off using three separate text components positioned close together, and having three separate columns in your conditions file to feed the text in.

Thanks David, however, I already did that but I have this message:

thisComponent.tStart = None
AttributeError: ‘numpy.int64’ object has no attribute ‘tStart’

How can I fix this? what am I doing wrong?

Andrea

@andreamorag, this error may occur if you have overwritten your text component with a number, maybe in a code component.

Thanks David! now I fix that but I have another problem. Now I have three separate text components, one for each letter. In the first recall I showed three letters and works perfect but in the second I only showed one letter (i.e. in the second text component because it is in a specific position) but the program is showing the previous letters if I let the csv file in blank. Is there any form that I can tell PsychoPy to showed no letters in text components one and three?

Andrea

I have another image (image1) but although it is not in the clickable stimuli it is clickable and continues to the next trial, any ideas for me to solution this problem? Sorry, this is my first experiment in psychopy,

Andrea

For this one, you can add a code component, and in the End Routine tab, clear the text in each one of your text components.

textStim.text = ''

However, I would expect the text components to be reset if the conditions file entry for that routine is blank:

IF your image is not a valid clickable object, then clicking that object should not end the trial. Perhaps there is overlap with your other clickable stimuli?

Thanks David, I attached you the documents of my experiment, maybe this is a better form for me to show you. The code component that you suggest me doesn’t work :frowning:
I have another problem with the feedback timing in case you can help me :slight_smile:
The image is not clickable (imagen_grilla2) and I have some superposed squares in red in some recalls to recall position but not in all of them.

conditpractica1.xlsx (9.3 KB) conditpractica2.xlsx (8.6 KB) condspractica.xlsx (8.5 KB) recall1.xlsx (9.8 KB) recall2.xlsx (9.5 KB) construyendo con builder.psyexp (72.1 KB)

Maybe if you can also check the problem that I have with feedback, I really appreciate it too! :slight_smile: