Clickable text fails

HI @TParsons sorry for all of the questions but I’m a new psychopy user. So I can make this modification as you suggested but the problem is that I don’t have a coder view in my psychopy. If I go to view in the builder dropdown menu, there is no option to view coder. If I change my preferences so that it automatically opens the coder when I open psychopy, it still just opens the builder. Is this a macOS problem? Should I re-download psychopy?

This is all done within the Builder view. Go to the component panel and inside the “Custom” section, you’ll see a “Code” component icon. Click that. It has tabs for various times during the experiment when custom code will run (e.g. at the start of the experiment, at the beginning or end of a routine, and so on).

Take the code suggested by Todd and paste it into the “each frame” tab, so that it will run on every screen refresh (typically 60 times per second).

This saves you from directly editing the generated Python script in the Coder view, which can be difficult and unwieldy.

2 Likes

Ah thank you! I understand, thanks for the explanation.

Hi everyone,

I keep running into the same problem every now and then. Weirdly, it works in some experiments…
However, I checked the py code of my current experiment and saw the double brackets around my list of clickable stimuli.
I tried the code as work around but it didn’t work in my case. I get an Indentation error, whenever I leave the clickable stimuli prompt empty.
Looking at the py code, it just looks like the code git cropped, which causes indentation errors in the next line.

        if Prac_mouse.status == STARTED:  # only update if started and not finished!
            buttons = Prac_mouse.getPressed()
            if buttons != prevButtonState:  # button state changed?
                prevButtonState = buttons
                if sum(buttons) > 0:  # state changed to a new click

Did anybody else encounter this problem?
Is there a way to change the way the list is converted?

Thanks in advance.

Best, Kathrin