| Reference | Downloads | Github

RatingScale.noResponse not working?

OS (e.g. Win10): MacOS Mojave 10.14.6
PsychoPy version (e.g. 1.84.x): 2020.1.2

What are you trying to achieve?:
I have a routine with 6 rating scales, all showing on the screen at once. I want to make sure all of the scales have a rating before allowing the participant to continue.

What did you try to make it work?:
I have created a code component that does the following:

In “Begin Routine”

# create button that will activate once all Qs are answered
continueButton = visual.ButtonStim(win, labelText= "done", pos=(.45, -.45))

Then, in “Each Frame”

# draw continue button

# how many questions are still unanswered?
n1 = int(nasaMental.noResponse)
n2 = int(nasaPhysical.noResponse)
n3 = int(nasaTemporal.noResponse)
n4 = int(nasaPerform.noResponse)
n5 = int(nasaEffort.noResponse)
n6 = int(nasaFrustration.noResponse)

print(n1) # for debugging

nasaUnanswered = n1 + n2 + n3 + n4 + n5 + n6
print(nasaUnanswered) # for debugging

nasaComplete = nasaUnanswered == 0
print(nasaComplete) # for debugging

# enable button when form is complete
if nasaComplete:
    continueButton.buttonEnabled = True

# if activated button is pressed, proceed
if continueButton.buttonSelected:
    continueRoutine = False

What specifically went wrong when you tried that?:
I can click on the scales and give ratings; however, the continue button is not enabled after I rate all 6 scales. When I print out the value of one of the scales (see above code), it seems that .noResponse is still == 1 even after I have clicked on the scale.

Any thoughts?

1 Like

I figured it out; I will write my solution here in case it helps anyone.
The RatingScale method .noResponse only works well with the “show accept” option. It is the act of clicking “accept” that changes .noResponse to FALSE; without that accept button, .noResponse will stay TRUE forever.
Since I didn’t want an accept button for each of my sliders, I needed to use the .getRating() method. See code below.

# how many questions are answered?
n1 = nasaMental.getRating() is not None
n2 = nasaPhysical.getRating() is not None
n3 = nasaTemporal.getRating() is not None
n4 = nasaPerform.getRating() is not None
n5 = nasaEffort.getRating() is not None
n6 = nasaFrustration.getRating() is not None

nasaAnswered = n1 and n2 and n3 and n4 and n5 and n6

# draw & enable button when form is complete
if nasaAnswered:
    continueButton.buttonEnabled = True

# if the activated button is pressed, proceed
if continueButton.buttonSelected:
    continueRoutine = False

1 Like