Code rating scale with custom code in builder

Hello,

I am very new to psychoPy and coding and want to create an rating scale from scratch with custom code in builder. (Just creating it via the builder is no valid option for me here because of further processes in my experiment that don´t work if I do it like this)

I tried around a little bit, looked at the compiled script etc but the rating scale never even gets displayed.

What is wrong with my code shown in the screenshot/What is missing?
Basically I want a rating scale that lasts 4 seconds (how do you do this with code?), has a certain amount of steps it with 2 labels displayed at the end points and which is navigateable with the 1,2 and 3 keys.

Thans in advance for the help!

Sliders and forms work online, but rating scales don’t.

Thanks, good to know for future experiments. For this one I only need it offline anyway.

No problem. I’ll move your question from online to coding.

In general we don’t advise using RatingScale as you can now do everything it does using Slider/Button, which should be more stable and actively maintained.

What’s missing is setting autoDraw - this is the parameter which tells PsychoPy to draw the component. To give it a set start and end, you can set autoDraw within an if statement in Each Frame, like so:

if myStartTime < t < myStopTime:
    myRatingScale.autoDraw = True
else:
    myRatingScale.autoDraw = False

thanks very much!