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