Sliders with images

OS (e.g. Win10): win 10
PsychoPy version : PsychoPy 2021.1.0
Standard Standalone? (y/n) Yes


I’m trying to present images according to my slider values, for example, emotional intensities from 0 to 100 and corresponding emotional faces.

With help from others in this forum, here is what I’ve tried:

First, I want my slider to contain 101 different values, and


begin with one randomly chosen from ‘Anchor’.


Also, I added this to made it possible to move with keyboard, using left and right arrows.


And here I insert $sld_list[int(slider_practice.getRating())] to get images.

($sld_list is a list of my stimuli)

It works fine when I use mouse. whenever I put my mouse click off, there are images corresponding to slider values. When I press left or right arrow to move my slider, however, the slider moves but the image does not change at all. How can I do it?

I’m guessing the problem is that recordRating doesn’t update the displayed value of the Slider, just the value recorded. Try using slider_practice.rating -= 1 and slider_practice.rating += 1 instead

1 Like

Thank you, Parsons! It worked. Would you mind if I ask you one more question about slider?

Since my slider contains 101 steps, it seems to be inconvenient to adjust slider step-by-step. I would like to make it move more smoothly. Is there any way to deal with this issue?

The granularity parameter of a Slider defines its step size - so if you set it to be 0, then it will move smoothly.

1 Like

Thank you for spending time on my questions, Parsons!