# Makie: update slider visual position from different observable trigger (i.e., reset sliders)

**URL:** <https://discourse.julialang.org/t/makie-update-slider-visual-position-from-different-observable-trigger-i-e-reset-sliders/100982>\
**Category:** Visualization\
**Tags:** question, makie\
**Created:** [June 29, 2023, 3:39pm UTC](https://discourse.julialang.org/t/makie-update-slider-visual-position-from-different-observable-trigger-i-e-reset-sliders/100982 "2023-06-29T15:39:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Datseris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/datseris/32/13406_2.png) [@Datseris](https://discourse.julialang.org/u/Datseris)\
**Post date:** [June 29, 2023, 3:39pm UTC](https://discourse.julialang.org/t/makie-update-slider-visual-position-from-different-observable-trigger-i-e-reset-sliders/100982/1 "2023-06-29T15:39:42Z")

</div>

I am making some Makie sliders using the standard API of the `SliderGrid`.

Below the sliders I want to add a button `reset`, which once clicked will reset all sliders to their original value. I do have the original values saved externally. Here I want to **visually reset the slides**. In my code I anyways have an observable that gets triggered both on slider updated _or_ on the reset button hit. So the actual code that uses the sliders does not have a problem. My problem is that the user that uses the GUI hits the reset button, which is reflected in the actual plots the GUI controls, but the slides themselves do not change. And this is confusing for the user…

So, is it possible to change **the visual location of a slider** without actively clicking the slider in the GLMakie window, but rather with code from an observable trigger?

---

<div class="post-metadata">

**Author:** ![Dan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dan/32/42581_2.png) [@Dan](https://discourse.julialang.org/u/Dan)\
**Post date:** [June 29, 2023, 4:10pm UTC](https://discourse.julialang.org/t/makie-update-slider-visual-position-from-different-observable-trigger-i-e-reset-sliders/100982/2 "2023-06-29T16:10:59Z")

</div>

This earlier post seems relevant:

> [@Coupling Sliders in GLMakie](https://discourse.julialang.org/t/coupling-sliders-in-glmakie/88130):
>
> I would like to be able to “couple” two sliders of a Makie.SliderGrid so that their value always adds to 1. That is, if I move the first slider I would like to Makie.set\_close\_to!(slider2, 1-slider1.value) and vice versa. However, I cannot figure out a way how to make this work. All of the ways that I can think of would introduce circular dependencies of Observables. Edit: I should also say that I am looking for a solution that generalizes to n \> 2 sliders. Here’s a sub of an example which has…

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [June 29, 2023, 5:57pm UTC](https://discourse.julialang.org/t/makie-update-slider-visual-position-from-different-observable-trigger-i-e-reset-sliders/100982/3 "2023-06-29T17:57:32Z")

</div>

`set_close_to!(slider, value)` is the function for that. It’s “close to” because you might not have the exact value in the range you passed to the slider, but it would be inconvenient to demand exact matches.

---

<div class="post-metadata">

**Author:** ![Datseris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/datseris/32/13406_2.png) [@Datseris](https://discourse.julialang.org/u/Datseris)\
**Post date:** [June 30, 2023, 8:54am UTC](https://discourse.julialang.org/t/makie-update-slider-visual-position-from-different-observable-trigger-i-e-reset-sliders/100982/4 "2023-06-30T08:54:15Z")

</div>

Thank you so much it worked :') I am crying tears of joy!
