URL of experiment:
Description: I need to create a letter detection task, where participants read a list of words and need to click on every letter ‘e’ they can detect. The only way to do this I could come up with was creating polygons on top of each letter e (46 e’s in total) that are transparent but turn green once you click on them. I place the polygons in the correct place using ‘norm’ units by trial and error.
Problem: Now, when I try out the experiment on different screens i see that the polygons are in wrong places, like they shift either horizontally or vertically depending on the screen ratio of the monitor.
How do I make sure that the text and the polygons are fixed to each other and independent of the type of screen.
I think you should use a fixed width font (e.g. Courier New) and height units.
In fact, this was a nice little demo to work on. Is this what you’re looking for?
Click on the letter e. Lines are split using \n in a code component. This is not sophisticated enough to split wrapped lines.
1 Like
Thank you for your response! I tried using courrier new and height units, and I’m running into the very same problem unfortunately)
The code you proposed is indeed what I am looking for but I think the polygon way would be better because data analysis would be easier (I named each polygon after the target word containing target letter ‘e’ and you can easily see which polygon was pressed and which wasn’t. Additionally, I do need multiple lines of text, a paragraph really, and I am not proficient enough in coding to split the wrapped lines.
Also, there’s another experiment I need to replicate, one where the participant needs to proofread a 1100 word short story and needs to find misspelled words and click on them. I have found that letter/word detection tasks aren’t really being done using Psychopy (I have looked on this platform and elsewhere online).
It would be nice to have a general protocol created for these types of tasks, because so far I’ve spent a lot of time doing trial and error, and I think it would make letter/word detection research possible that is now off limits to many researchers.
My code allows you to have multiple lines if you specify the line breaks with \n
Each e has a position defined by line and column number. It would be easy enough to compile a list of e positions from the text string. It just wasn’t required in order to identify whether then current selection was an e or not. With a little extra code the whole word could be identified (by searching for spaces before and after the selected letter).
1 Like
Hi again and thank you for your reply!
I’m still running into a few issues while trying to adjust the code you wrote to my experimental needs. From my understanding, it is still not directly tied to the letters themselves? And it still seems like it depends on the screen dimensions since when I try it out on pilot the polygons are in different places then they should be.
I’m guessing I need to change something around lines 360 and 650?
You need to manually add \n new line characters into the text. At the moment the code thinks there are only two lines of text not four.
That is what I did, i had replaced your short text with my longer one and added a “\n” in the middle, but because my text is longer it somehow automatically wraps the last words to the next line (as the words amongst and transparent in the photo I provided above). Changing the wrap width doesn’t seem to do much, and I really need all the lines I separate with \n to be on presented one line on the monitor, otherwise my long list of words simply won’t fit on the screen. I’ve tried tweaking some parameters but nothing seems to be working…
[/quote]
That is what I did, i had replaced your short text with my longer one and added a “\n” in the middle, but because my text is longer it somehow automatically wraps the last words to the next line (as the words amongst and transparent in the photo I provided above). Changing the wrap width doesn’t seem to do much, and I really need all the lines I separate with \n to be on presented one line on the monitor, otherwise my long list of words simply won’t fit on the screen. I’ve tried tweaking some parameters but nothing seems to be working…
If you want a line that is currently wrapping to appear on one line you could decrease the font size (in Begin Experiment in my code)
Or you could increase the width of the textbox.