Change answer on slider after first click, with forced response

OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): 2020.2.10
What are you trying to achieve?:


I want participants to be able to give an answer on a slider, then be able to change their mind and change their rating if they like, and then press space to continue. So a forced response, but with the possibility of changing your rating after your first click.

What did you try to make it work?:
Currently, I use this code component (each frame) to ensure that participants are forced to give an answer. After they picked an answer, they still have to press space in order to continue (which is what I want, and why I added event.waitKeys()). This works fine.
However, participants are not able to change their (slider)rating after their first click. How could I alter my code to make that possible?

if slider_bestgedaan.getRating() is not None:
    if key_resp.keys=='space': 

Thank you very much in advance for any help!

You shouldn’t use waitKeys() in Builder. How about

if slider_bestgedaan.getRating() is not None:
    keys = event.getKeys()
    if 'space' in keys: 

When I use this, the routine ends immediately after te first click on the slider, so a participant cannot change his mind. :confused:

The previous routine ends with space in a keyboard component, doesn’t it?

Add event.clearEvents() to Begin Routine

Hm, no it does not.

I do notice now that participants are able to change their rating IF they did not press space yet.
If I try to ‘’ skip’’’ the question by pressing space before giving an answer, you can only give one answer (click) and then you immediately move on to the next routine and do not have the option to change your answer anymore.

I would like to make it so that participants who press space before answering are still able to change their mind after their first click on the slider.

No problem


keys = event.getKeys()
if slider_bestgedaan.getRating() is not None and 'space' in keys:
1 Like

That works perfectly, thank you very much!