Radio slider over two lines? v2020.2.10

v2020.2.10 (images from experiment as piloting in pavlovia)

Hi,

I am trying to make a slider (radio) with 12 options. I managed to get it all on one line, but I was wondering if there is a way to split it up into 2 lines.

The labels are too long to fit all next to each other, so this (see images) is my current solution.

Does anyone know if I can spread the slider over two lines? Or is there another way to display all labels in a less chaotic way?

Thank you very much for any help!

You might need to update to 2021.1.x for this to work as it’s the version I’m testing it out in now, but you could make two radio sliders and add some code so that if one is set to anything but None, the other is always None. Meaning, essentially, you can only have one answer between them. So something like this:

if not slider1.rating is None:
    slider2.rating = None
if not slider2.rating is None:
    slider1.rating = None

However, this would overwrite all answers to slider2 with None if slider1 has a rating - so what we need to add is something to only do so when slider1 has a new rating (and vice versa for slider2). So I’d put something like this in Each Frame:

# Work out which slider(s) is/are active this frame
isActive = []
if not slider1.rating is None:
    isActive.append(slider1)
if not slider2.rating is None:
    isActive.append(slider2)
# If active and not previously, set other slider to None
if slider1 in isActive and not slider1 in wasActive:
    slider2.rating = None
if slider2 in isActive and not slider2 in wasActive:
    slider1.rating = None
# Store currently active for comparison next frame
wasActive = isActive

and then in Begin Routine:

wasActive = []

So each frame you’re not only checking whether there’s a rating, but storing this information and comparing against it next frame. The circularity of it is a bit mind bending but it does work!

1 Like

I’ve just realised there’s also a simpler solution, but for this you’ll definitely need to update to 2021.1.x: Go to the Appearance tab and, under “Style Tweaks”, tick “labels45”. This will rotate the labels by 45 degrees, so they fit together better!

2 Likes

Thank you very much!