| Reference | Downloads | Github

Rating scale reponse failure via keyboard

If this template helps then use it. If not then just delete and start from scratch.

OS (e.g. Win10):
Win 10
PsychoPy version (e.g. 1.84.x):
Standard Standalone? (y/n) If not then what?:
What are you trying to achieve?:
avoid having to click on the rating scale with the mouse to ‘activate’ it? i.e. can the rating scale be controlled entirely by keyboard?
What did you try to make it work?:
I used the method provided by Jeremy (!topic/psychopy-users/avVRbekKeQA)
What specifically went wrong when you tried that?:
the keyboard still did not respond for the first trial, I must use the mouse to response for the first trial, then rating scale for the following trials can respond via keyboard.
Include pasted full error message if possible. “That didn’t work” is not enough information.

PS: When I use MAC PsychoPy version 3.24 (Standard Standalone), this problem did not occur any more. So I think maybe this is a specific bug just for PsychoPy version 3.24 under Win10 OS.

Rather than RatingScale I now recommend you use the new Slider class which has more options and less confusing interface.

With Slider, you do need to set up your own controls for how to change its values with the keyboard but that’s relatively easy, and on the plus side you can control exactly how you want the updating to work.

e.g. with this on Every Frame to control a slider called slider_kbControl

if slider_kbControl.markerPos is None:
    # sets to our first position (or a random number?)
    # and makes marker visible
    slider_kbControl.markerPos = 3

#check keys (just the ones we want)
keysPressed = defaultKeyboard.getKeys(['left', 'right', 'return'])
for key in keysPressed:
    if key == 'left':
        slider_kbControl.markerPos -= 0.5  # subtract 0.5
    elif key == 'right':
        slider_kbControl.markerPos += 0.5  # add 0.5
    elif key == 'return':
        # confirm rating by setting to current markerPos
        slider_kbControl.rating= slider_kbControl.markerPos

Thanks for your quick reply! it works! And it’s much easier than rating scale!
if I want to add some description above the slider, how can I achieve it?

Add a text component to your routine

Thank you so much for your quick reply! It works!

I have a question about response time of slider. I gave paticipants max time of 5s to response to the slider, but as soon as the participants performed the rating, I want a ‘+’ appear on the screen for the reminder of the 5s, I set the start of the ‘+’ as slider.status ==FINISHED, how to set the duration of the ‘+’ ?

All components have an option to set their stop time. Simply set that to the value you need.You can choose either a duration or a time stop

Thank you so much for your great help, I also found a solution specific
to my question:(Fixation cross duration various duration)