Dynamic web pages with Interact and Mux

I am trying to write a web GUI controlling some instruments. The basic widgets are working but I’d need to print some variables in real time. MWE follows:

using Mux, Interact, CSSUtil
s = slider(0:0.01:1, label="Slider")
display(s)
observe(s)
h = HTML(string("<div>Slider value:",s[],"</div>"))
ui = vbox(s, h)
WebIO.webio_serve(page("/", req -> ui), 8110)

The goal is that the ‘Slider value’ field changes with variable s. With the code above, it only prints the initial value and stays constant.

Found it out myself, the following works:

using Mux, Interact, CSSUtil
s = slider(0:0.01:1, label="Slider")
observe(s)
display(s)
h = map(x -> HTML(string("<div>Slider value:",x,"</div>")), observe(s))
ui = vbox(s, h)
WebIO.webio_serve(page("/", ui), 8110)
1 Like