How do i align text in a grid

I am trying to create an experiment on how stress affects memory recall.
I am trying to create an impossible word search under timed conditions as the stressor task.
this is the code i have created so far:

This is how the word search itself looks like:

Also how do i enable the participants to highlight the words they find and how do i print the words to find on the screen so they can use it for reference.

I dont know python and i have to do this for a project at uni so any help will be greatly apreciated! :slight_smile:

Thanks!

As luck would have it I wrote a demo on Friday that will help.Letter detection task - #2 by wakecarter

thanks for the quick reply! :slight_smile:
would that help align the text cause thats letter detection
thanks

also im sorry but i dont understand where i would insert that code.
any extra help would be apreciated thanks

To align the text you would need to use a monospaced font, i e. Courier New.

However, on second thoughts, it might be better to create a list of text objects in a code component so you aren’t restricted to Courier New and can more easily detect which letter has been clicked on.

if i want click detection do i just insert the code you have provided in a new code component or do i have to modify it.

also sorry to bother you again but what do you mean by create a list of text objects. what does the list contain

grid= [ ]
for Idx in range(11):
     for Jdx in range(11):
          grid.append(
            visual.TextStim(win=win, 
            name='textName',
            text='displayedText',
            font='Arial',
            pos=(0 , 0),
            height=0.05, 
            wrapWidth=1, 
            ori=0, 
            color='white'))

The above would need to be modified so that each text object is in the right place with the right letter.

Did you use AI to write the code you have so far? Creating a wordsearch on the fly sounds like an interesting project, but not a simple one. I’d want it to run online if I did it, so I’d be using Auto code components without importing Python libraries.

Hi.

Thanks for the reply,

I did use AI to write the code as I don’t have experience with python but I did try modifying it using forums and YT.

Also, whats the difference between auto code components and code components or are they the same thing.

Do I add the text objects In a new code component or if no where would I inset it in my code.

And how would I create click detection for the letters in the word search so they can be highlighted when clicked on by the participants.

Thanks for your help so far :blush:

Code components can be Python only or auto translate into JavaScript or JavaScript only or have independent Python and JavaScript (Both).

What sort of project is this for? A wordsearch doesn’t seem suitable as a first PsychoPy project for someone without Python expertise.

its for my uni assignment

@wakecarter sorry to bother you again but do you know how to create a link for a psychopy experiment so i can send it out
thanks

Do you mean that you want to run it online?

yes but is there a way of creating a link so i can post it on snap

https://psychopy.org/online/usingPavlovia.html#usingpavlovia

However, the code you previously showed was in Python only so it won’t work online.

For my personal interest, I’ve written a wordsearch that does work online which might be very close to what you want. However, I’d need to have an email conversation with your supervisor before I’d be happy for you to have access to it. It turned out to be quite challenging to get the word identification to behave as smoothly as I wanted.

https://run.pavlovia.org/vespr/wordsearch/

why would it not work online if its only on python @wakecarter

what can i do to make it work

Python won’t run online. PsychoPy auto-translates PsychoPy to PsychoJS. Still, a word-search is not a trivial task to program.

Best wishes Jens