| Reference | Downloads | Github

Rating Scale Memory Leak, changing to Slider


I have encountered the known issue with the rating scale having a memory leak.
As such, I have swapped my experiment over to using the slider feature. However, I am attempting to have the input for the slider tied to a keyboard (left, right, accept) buttons.
For the rating scale, I was able to code that, however, I do not see a way to code that for the slider feature.

Any feedback would be greatly helpful.

Hi @nsurdel, add a slider and keyboard (set to not end routine on keypress), and use the following code (note keyboard and slider are called key_resp and slider, respectively):

# Begin Routine
slider.markerPos = 2  # Or whatever the middle value of your slider is

# Each Frame
if key_resp.status == STARTED and not waitOnFlip:
    if len(theseKeys):
        if theseKeys[0].name == 'left':
            slider.markerPos -= 1
        elif theseKeys[0].name == 'right':
            slider.markerPos += 1

Hi David,

Thanks for your response.
This hasn’t quite appeared to work.

Neither the marker appeared nor the keys move any figurative marker.

Is there, perhaps another way it might work?

This should work, here is the Builder file:

controlSlider.psyexp (7.7 KB)