| Reference | Downloads | Github

Change in style of radio buttons


Is it possible to change and adjust the color of the radio buttons?

I need to change radio so that it has:

  • a black color of labels (it’s ok now)
  • black border (line of circle),
  • white filling and
  • black ans smaller marker.

now i have:
big red marker in black circle:

Is there any parameters that I can add to code or change it? I see that I can oly add black to all style


Hi @sylwia3234, I do not think you can change the outline style of the marker place holder, but you can set it to black in the slider dialog > Appearance settings. To change the marker itself, add a code component and use

slider.marker.lineColor = "white"
slider.marker.fillColor = "black"
slider.marker.size = slider.marker.size / 2

I have some problem with code, I added what you said: ‘keyword can’t be expression’

I am not good at code so I don’t know what is wrong I tried to change it in some ways but it doesn’t work.

Ah so you would not add it to the slider code. These are attributes that you change after the slider has been created. The name "slider " is also generic, you would use "Trening_2_radio" in place of the word "slider".

Yeah, I tried to to this with this name, but it shows the same error

Your code should look something like:

Trening_2_radio = visual.Slider(win=win #... etc
# ...
flip=False)  # Close brackets - object now created

# Set attributes of Trening_2_radio
Trening_2_radio.marker.lineColor = "white"

Ok. Thanks!
Now it works, I had a code inside brackets, now I have outside and it works.