How to toggle a button with Makie.jl?

You can for example use an observable to track the play/pause state and lift the button label off of that.

running = Node(false)

function toggle_running()
    running[] = !running[] # or more complex logic
end

b = Button(..., label = @lift($running ? "PAUSE" : "PLAY"))

on(b.clicks) do _
    toggle_running()
end
3 Likes