psychopy.org | Reference | Downloads | Github

Check for rating and keyboard press to continue routine

Hi everyone. I apologize for this painfully simple question but I just can’t seem to figure this out.

I want to continue a routine with spacebar after checking that participant has given a slider response. (This is to hopefully fix slider issues when hosting online).

Here is some code I tried:

keys = event.getKeys

if 'space' in keys:
    if slider_5.getRating() is not None:
        continueRoutine = False 

But I get the error "TypeError argument of type ‘function’ is not iterable

Is there a better way to write this code?

I would preferably like to do this without having to add a keyboard component in builder over and over again. Is this possible?

Thank you for any help.

This code gets ratings from 5 sliders and then continues only when c is pressed.

all_ratings=[slider_1.getRating(),slider_2.getRating(),slider_3.getRating(),slider_4.getRating(),slider_5.getRating()]
all_rating_type=[i!=None for i in all_ratings]
if key_response_4.status == STARTED and not waitOnFlip :
    theseKeys = key_response_4.getKeys(keyList=['c'], waitRelease=False)
    if (len(theseKeys)and all(all_rating_type)):
        # a response ends the routine
        continueRoutine = False

I also think that you are almost there. Try event.getKeys()