# Slider Granularity

**URL:** <https://discourse.psychopy.org/t/slider-granularity/22647>\
**Category:** Builder\
**Created:** [April 28, 2021, 2:36pm UTC](https://discourse.psychopy.org/t/slider-granularity/22647 "2021-04-28T14:36:24Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![ozgezer](https://avatars.discourse-cdn.com/v4/letter/o/46a35a/32.png) [@ozgezer](https://discourse.psychopy.org/u/ozgezer)\
**Post date:** [April 28, 2021, 2:36pm UTC](https://discourse.psychopy.org/t/slider-granularity/22647/1 "2021-04-28T14:36:24Z")

</div>

Hi everyone,

I am struggling with adjusting my radio label slider as integer scale in a way that will not let click between different options.

**OS** ( Win10):  
**PsychoPy version** (2021.1.2):

**What are you trying to achieve?:**  
I am trying to use slider, radio labels to get responses from categories (emotion labels like Angry, Happy,…).

**What did you try to make it work?:**  
I chose granularity as 1 to make it integer instead of having continuous one with 0. I also tried to clear caches, deleting and uploading the experiment and trying to run it in a private window. Also, I tried to add marker however, it does not appear at all neither online nor remotely.

**What specifically went wrong when you tried that?:**  
I can still click the space between two options, so adjusting granularity do not work.

Thank you for any help in advance 🍀

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [April 28, 2021, 2:48pm UTC](https://discourse.psychopy.org/t/slider-granularity/22647/2 "2021-04-28T14:48:46Z")

</div>

What do you have in “ticks”? I think you need (1,2,3) for three radio buttons if your granularity is 1.

---

<div class="post-metadata">

**Author:** ![Anouk](https://avatars.discourse-cdn.com/v4/letter/a/e0b2c6/32.png) [@Anouk](https://discourse.psychopy.org/u/Anouk)\
**Post date:** [April 28, 2021, 2:50pm UTC](https://discourse.psychopy.org/t/slider-granularity/22647/3 "2021-04-28T14:50:00Z")

</div>

As far as I know, when you click between the buttons, the option closest will be selected as the answer. (So even when you click on something between the buttons, something will be selected.) Can you see this in your data?

---

<div class="post-metadata">

**Author:** ![ozgezer](https://avatars.discourse-cdn.com/v4/letter/o/46a35a/32.png) [@ozgezer](https://discourse.psychopy.org/u/ozgezer)\
**Post date:** [April 28, 2021, 2:53pm UTC](https://discourse.psychopy.org/t/slider-granularity/22647/4 "2021-04-28T14:53:48Z")

</div>

I have ticks as (1,2,3,4) for four radio buttons and granularity is 1.

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [April 28, 2021, 2:54pm UTC](https://discourse.psychopy.org/t/slider-granularity/22647/5 "2021-04-28T14:54:17Z")

</div>

Okay – so I just tied clicking in the middle of a radio slider with two options (1,2) and it did select one of them. Is that what you are trying to avoid?

---

<div class="post-metadata">

**Author:** ![ozgezer](https://avatars.discourse-cdn.com/v4/letter/o/46a35a/32.png) [@ozgezer](https://discourse.psychopy.org/u/ozgezer)\
**Post date:** [April 28, 2021, 2:54pm UTC](https://discourse.psychopy.org/t/slider-granularity/22647/6 "2021-04-28T14:54:35Z")

</div>

I noticed that this is the case, however, children will be completing the task so it is important to be sure that they clicked on a certain option. not in the middle.

---

<div class="post-metadata">

**Author:** ![ozgezer](https://avatars.discourse-cdn.com/v4/letter/o/46a35a/32.png) [@ozgezer](https://discourse.psychopy.org/u/ozgezer)\
**Post date:** [April 28, 2021, 2:55pm UTC](https://discourse.psychopy.org/t/slider-granularity/22647/7 "2021-04-28T14:55:33Z")

</div>

Yes, I don’t want them to choose somewhere in the middle and possibly recording unintended option.

Btw thanks a lot for your quick reply.

---

<div class="post-metadata">

**Author:** ![Anouk](https://avatars.discourse-cdn.com/v4/letter/a/e0b2c6/32.png) [@Anouk](https://discourse.psychopy.org/u/Anouk)\
**Post date:** [April 28, 2021, 2:58pm UTC](https://discourse.psychopy.org/t/slider-granularity/22647/8 "2021-04-28T14:58:49Z")

</div>

Do you see the red/coloured dot when you select a button?

If you disable ‘force end of routine’ and add a spacebar which can only be used to force the end of a routine once an answer on the slider scale has been clicked, you are able to see a red dot when you click a button. This way it is very clear what you selected.

---

<div class="post-metadata">

**Author:** ![ozgezer](https://avatars.discourse-cdn.com/v4/letter/o/46a35a/32.png) [@ozgezer](https://discourse.psychopy.org/u/ozgezer)\
**Post date:** [April 28, 2021, 3:10pm UTC](https://discourse.psychopy.org/t/slider-granularity/22647/9 "2021-04-28T15:10:15Z")

</div>

Thanks a lot for your reply. 🍀 I get what I need to do however I couldn’t figure out how to code force end of routine. Also, could it be possible to make double click instead of spacebar so that it will be easier for children?

---

<div class="post-metadata">

**Author:** ![Anouk](https://avatars.discourse-cdn.com/v4/letter/a/e0b2c6/32.png) [@Anouk](https://discourse.psychopy.org/u/Anouk)\
**Post date:** [April 28, 2021, 3:16pm UTC](https://discourse.psychopy.org/t/slider-granularity/22647/10 "2021-04-28T15:16:24Z")

</div>

> [@Change answer on slider after first click, with forced response](https://discourse.psychopy.org/t/change-answer-on-slider-after-first-click-with-forced-response/21169/6):
>
> No problem Try keys = event.getKeys() if slider\_bestgedaan.getRating() is not None and 'space' in keys: continueRoutine=False

```auto
keys = event.getKeys()

if yourslidernamehere.getRating() is not None and 'space' in keys:
        continueRoutine=False

```

in Python, and you then auto-generate JS code and change the ‘Null’ to ‘undefined’ as per wakefields cribsheet.

(Note: I did not try this in 2021.1.2 but it did work in 2020.2.10)

I do not know about the double click, I am sorry.

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [April 28, 2021, 3:21pm UTC](https://discourse.psychopy.org/t/slider-granularity/22647/11 "2021-04-28T15:21:23Z")

</div>

I wonder if it would be possible to change the granularity (e.g. to .25) but then only end the routine if the answer was 1 or 2.

---

<div class="post-metadata">

**Author:** ![ozgezer](https://avatars.discourse-cdn.com/v4/letter/o/46a35a/32.png) [@ozgezer](https://discourse.psychopy.org/u/ozgezer)\
**Post date:** [April 28, 2021, 3:56pm UTC](https://discourse.psychopy.org/t/slider-granularity/22647/12 "2021-04-28T15:56:17Z")

</div>

Sorry if this is something so simple. I make it work partially however, it does not continue routine after pressing space. I tried to change space to enter, it didn’t work neither.

---

<div class="post-metadata">

**Author:** ![ozgezer](https://avatars.discourse-cdn.com/v4/letter/o/46a35a/32.png) [@ozgezer](https://discourse.psychopy.org/u/ozgezer)\
**Post date:** [April 28, 2021, 3:56pm UTC](https://discourse.psychopy.org/t/slider-granularity/22647/13 "2021-04-28T15:56:33Z")

</div>

I will try this too and let you know if I make it work. Thanks 🙂

---

<div class="post-metadata">

**Author:** ![Anouk](https://avatars.discourse-cdn.com/v4/letter/a/e0b2c6/32.png) [@Anouk](https://discourse.psychopy.org/u/Anouk)\
**Post date:** [April 29, 2021, 7:12am UTC](https://discourse.psychopy.org/t/slider-granularity/22647/14 "2021-04-29T07:12:40Z")

</div>

Did you enter it in the ‘each frame’ code component?

---

<div class="post-metadata">

**Author:** ![ozgezer](https://avatars.discourse-cdn.com/v4/letter/o/46a35a/32.png) [@ozgezer](https://discourse.psychopy.org/u/ozgezer)\
**Post date:** [April 29, 2021, 7:42am UTC](https://discourse.psychopy.org/t/slider-granularity/22647/15 "2021-04-29T07:42:13Z")

</div>

Thanks a lot! It works perfectly now.
