Use image as slider on Pavlovia

Hi!

URL of experiment:

Description of the problem:

In my experiment, the participants need to rate the pictures from the International Affective Picture System (IAPS). Therefore, I want to use the rating scale from the original study (see first picture).
In the local experiment, I used the following code (Begin Routine) and it works out pretty well:

slider.line.tex = 'arousal.jpg'
slider.line.sf = 1
slider.line.size = (0.90, .14)

and i also changed the size of the marker by using this:

slider.marker.size=(0.03,0.03) 
slider2.marker.size=(0.03,0.03)

However, on Pavlovia it looks like this:

And unfortunately, the marker is not even visible.

I already tried the solution from this thread: Type error with code component on Pavlovia and used the following code online:


slider._bartex = "arousal.jpg";
slider._barsf = 1;
slider._barsize = [0.9, 0.14];
slider._markersize = [0.03, 0.03];

I’d be really happy, if you have any advise for me!

Thank you

Kind regards
Max

This is most likely due to differences in how the slider is structured online. Instead of replacing the line with an image, you could set the line color to None (so that the line is invisible) and then have the image as an :image: Image component behind it? So long as you line up the sizes it should have the same effect - I believe the width calculation would be:

mySlider.size[0] / len(mySlider.labels) * (len(mySlider.labels) - 1)

(replace mySlider with the name of your slider)

Thank you very much! I just did it as you said. And now, after some adjustments it works really well.

Kind regards
Max

1 Like