psychopy.org | Reference | Downloads | Github

Using my own image for a slider

Hello
I’m coding in PyCharm.
Is it possible to use the slider component with my one image?


thank you very much!

The line of the Slider class is actually just a GratingStim by default so I think you could do something like this (after creating mySlider):

mySlider.line.tex = 'myHeatMapFile.png'

where myHeatMapFile.png would ideally be a square-power-of-2 texture (e.g. 48x48 pixels)

For other ideas, take a look at the existing style customizations that have been made in the following lines of the repo:
psychopy/slider.py at master · psychopy/psychopy · GitHub

1 Like

thank you. it didn’t work unfortunately

vas = Slider(win,
ticks=(1, 100),
granularity=1,
pos=[0.01, -0.46])
vas.line.tex = ‘image.png’

the image is 48*48 px but it doesn’t display the full range of the color map

@galaharon , perhaps you need to rotate the image 90 degrees by saving it at the new orientation. It looks like only the centre color of the image is being drawn.

thank you but it still didn’t work
i also tried to rescale it

Ok, try adding the following after you set the tex

vas.line.sf = 1
1 Like

worked perfectly! thanks!!