Radiobuttons and checkboxes in Makie

How could I create radiobuttons and checkboxes in Makie?

Instead of checkboxes you can try toggles: Toggle

Or someone motivated implements them :slight_smile:

You could have a look at existing widgets:

I did this for two radiobuttons :

f = Figure()
cb1 = Checkbox(f[1, 1])
cb2 = Checkbox(f[1, 2])
on(cb1.checked) do val_1
        if cb1.checked[] && cb2.checked[]
            cb2.checked = false
        end
    end
on(cb2.checked) do val_2
        if cb2.checked[] && cb1.checked[]
            cb1.checked = false
        end
    end
f

You can do this more robustly with the onchange attribute Checkbox | Makie where you can separately keep track of the radio selection

2 Likes

Yes, I saw this but didn’t understand how to use it so I went the dumb route

I had an example in the PR that added Checkbox Add new `Checkbox` block by jkrumbiegel · Pull Request #4336 · MakieOrg/Makie.jl · GitHub

1 Like

Nice thanks !