| Reference | Downloads | Github

RatingScale Issue

The following code is for a rating scale:

    scale = visual.RatingScale(win, low=1, high=9, pos=(0,0), size=1.5, marker=visual.TextStim(win, text="", units="norm"), noMouse=True, tickMarks = label,
            textSize = 0.7, respKeys = ['num_1','num_2','num_3','num_4','num_5','num_6','num_7','num_8','num_9'], minTime=0.0, scale = scales,
            showAccept = False,labels = label, textColor="White", stretch=1.5)
    text.pos = (0.0, 0.7)
    text.height = 0.07
    rate_start = timer.getTime()
    while timer.getTime() < 10.0 + rate_start - extra_time:
        if 'escape' in event.getKeys(keyList=['escape']):
        if scale.getRating():

Since I’m using a PC, the valid response keys I want are 1-9 on the number pad. I want to scale to remain on the screen until one of the response keys is pressed (or 10 seconds is up). My issue though is that if I press the Enter key on the num pad, it is accepted as a response and I break out of my while loop. I don’t understand why this is, but is there a way to prevent this from happening and only allowing keys 1-9 be accepted?

Thanks for the help.