This shows a PsychoPy slider object which can be moved using the left and right arrow keys or hovering over the slider with the mouse. Responses are submitted with a mouse click or the return key. The position of the slider is also recorded every 3 frames and presented on the screen in addition to being saved to the console and the data file.
However, I still need some help with a couple of points.
I have tried unsuccessfully to change the colour of the marker and the wrap width of the labels online using the following code:
Python
for label in slider.labelObjs:
label.height = .03 # Or whatever size you want
label.wrapWidth = .2
label.text=slider_labels.pop(0)
slider.marker.color=blue
Because of the current bug with color I actually use a polygon overlaying the marker (the color of that is easy to change), and set the marker alpha to 0.
With a polygon for mouse interaction and a polygon for marker colour and having to save marker pos because get slider doesn’t work and having experimentInit to realign the labels which can’t be changed in number I feel like at the moment it would be easier for me to write a customisable slider from scratch
But there is already a pull request in place to getMarkerPos, an issue raised to fit setFillColor (both linked above) and a demo there to provide a work around until those are fixed.
Perhaps if you have any recommendations for bug fixes/issues you can ensure quickest development by flagging the team or making pull requests at the psychoJS github. Being quite new to JS myself I can say it is quite fun to help directly fix those bugs!
Over the summer when I have more time I should definitely to to learn how to make pull requests.
For now, I’ve updated my interactive slider demo with a custom slider that looks and behaves nearly identical to the standard slider offline and doesn’t change appearance online.
Hi, I find this code changed your interactive slider marker color online successfully if add to the each frame tab for JS, but somehow when I use it to change the color of the default slider without any code, the marker just becomes invisible.
// Each Frame
slider._skin.STANDARD.MARKER_COLOR = new util.Color([1, 1, 1]);
@wakecarter i am using the interactive slider for one of my projects. How do i change the nametags/markers on the scale? i am a newbie at psychopy who is using the builder view and your help would be appreciated
thank you very much for that nice demonstration of a an interactive slider!
When trying the demo online it works smoothly and as expected.
Unfortunately however, when downloading the source code and trying it, the marker doesn’t stop moving, even though I am releasing the key, which is a problem that occured to me as well, when I was implementing my own interactive slider implementation. Would you have any idea, what could be the problem, when keys[-1].duration keep the value None, even though I am lifting the key?