Dragging marker in slider component only if it has been pressed

I’m new to Psychopy and I want to create a slider component such that the marker is moving only if the subject pressing on it.
if the subject press on the slider but not on the marker I do not want the marker to be able to move.
I looked in this link - Is it possible to make a slider object only interactable by dragging the marker?

but when I copied the DragOnly function (place it in the “Before Experiment” in the code component) and tried to activate it on my slider component it didn’t work.

please let me know if I did something wrong or I just miss understood the DragOnly function.

thank you!

I placed the “DragOnly” function in the “Begin Experiment” **

does someone can help me please?

It doesn’t look like your slider name is slider. It’s set to example_slider or something similar.
You can either change your slider name to slider or replace the name slider with example_slider in your code component.

thank you very much!

1 Like