| Reference | Downloads | Github

Using a slider and a press button in the same window

I’m not very experienced with Psychopy and would love to get some help.
I wrote a simple code for an experiment that asks the subject to choose a certain amount of money between 0 to X, using a slider, than press a continue button (using the mouse) to move to the next amount (total of 4 times for 4 different amounts of money).
The thing is that the slider doesn’t slide. I think that the cause to this is the “continue” button, since the slider works fine when I remove the button (and instead give a time limitation). The continue button is a circle shape, that when you press on it, you move to the next window.I actually need it to be not limited by time so the “solution” I described above is not useful to me.
How can I solve it- keep the continue button and still have the slider slider to slide?
Thank you.

Hi @Talor_Shamash.

What do you mean the slider does not slide? Do you mean that pressing the circle would end the routine without any slider ratings? If so, check this topic:

I had this issue in the online experiment, but you can use the same method for local experiments. Alternatively, you can use this code:

if smy_slider.getRating() and my_mouse.isPressedIn(my_circle):
    continueRoutine = False

Hi Omidrezaa,

Thank you for your help.
By saying that it doesn’t “slide” I mean that when I try to move marker it doesn’t slide. Instead, I can only move it by clicking on the slider’s bar itself. If I try to describe how it looks, it’s like the marker “jumps” to where I click on the bar, but I cannot hold the marker and drag it to the place I want.
The circle doesn’t end until I press the “continue” button, so that is not the problem.

Thanks for the explanation. I think you can solve this issue by setting the Granularity to 0 in the builder. Check the screenshot below. 0 is for continuous scale and 1 is for integer scale (which jumps between values and you cannot slide).


thank you again, but even with granularity=0 it still happens.
I really think it has something to do with the “press to continue button”, because when I take this requirement to press a button to continue off, and instead do the slider assignment time limited, the slider works just fine.