Can you do circular callbacks in Julia Dash?
It seems that this functionality was available in python’s dash 1.19…
We’re pleased to announce that Dash 1.19.0 is out
pip install dash==1.19.0
Dash 1.19.0 is backwards compatible feature release that:
Adds support for circular callbacks that within the same callback. Thanks to @chadaeschliman for the contribution!
Adds a drag_value property to dcc.Slider to fire callbacks from dragging and releasing.
Adds a much needed close button to close the Dash Dev Tools. Many thanks to @AnnMarieW for the contribution
Upgrades plotly.js, the gra…
But I can’t seem to replicate it in Julia… I do get an error message regarding circular callbacks though.
If its not implemented, any ideas on when it will be?
jack
October 11, 2021, 4:10pm
2
Hey @Wingmore this should work if it works in Python. Can you please post a small Julia code example here that’s not working?
Code tried:
@time using Dash, DashHtmlComponents, DashCoreComponents, DashTable
@time using DashBootstrapComponents
external_stylesheets = ["https://codepen.io/chriddyp/pen/bWLwgP.css"]
app = dash(external_stylesheets=external_stylesheets)
app.layout = html_div() do
[
dcc_slider(
id="slider-circular", min=0, max=20,
marks=[(i=string(i),) for i in 1:21],
value=3
),
dcc_input(
id="input-circular", type="number", min=0, max=20, value=3
),
]
end
callback!(
app,
Output("input-circular", "value"),
Output("slider-circular", "value"),
Input("input-circular", "value"),
Input("slider-circular", "value"),
) do input_value, slider_value
ctx = callback_context()
trigger_id = ctx.triggered[0]["prop_id"].split(".")[0]
trigger_id == "input-circular" ? value = input_value : slider_value
return value, value
end
ERror:
ERROR: LoadError: Circular input and output arguments were found. Please verify that callback outputs are not also input arguments.
Stacktrace:
[1] error(s::String)
@ Base .\error.jl:33
[2] check_callback(func::Function, app::Dash.DashApp, deps::Dash.CallbackDeps)
@ Dash C:\Users\Wingmore\.julia\packages\Dash\Weukk\src\app\callbacks.jl:181
[3] _callback!(func::var"#467#468", app::Dash.DashApp, deps::Dash.CallbackDeps; prevent_initial_call::Nothing)
@ Dash C:\Users\Wingmore\.julia\packages\Dash\Weukk\src\app\callbacks.jl:129
[4] callback!(::var"#467#468", ::Dash.DashApp, ::Output{String}, ::Vararg{Dash.Dependency, N} where N; prevent_initial_call::Nothing)
@ Dash C:\Users\Wingmore\.julia\packages\Dash\Weukk\src\app\callbacks.jl:108
[5] callback!(::var"#467#468", ::Dash.DashApp, ::Output{String}, ::Output{String}, ::Input{String}, ::Input{String})
@ Dash C:\Users\Wingmore\.julia\packages\Dash\Weukk\src\app\callbacks.jl:104
[6] top-level scope
@ c:\Users\Wingmore\Desktop\everything\Julia tutorials\circular_callback_dash.jl:21
in expression starting at c:\Users\Wingmore\Desktop\everything\Julia tutorials\circular_callback_dash.jl:21
Your link redirects to the python one. Also I’ve noticed that the julia Advanced callback ends prematurely: theres some sections in python not in julia docu here:
https://dash-julia.plotly.com/advanced-callbacks
waralex
December 30, 2021, 10:31am
6
Hi all!
I added the possibility of circular callbacks in Dash.jl 1.1.0
P.S. Sorry, I should have answered earlier, but I was following julia’s resources and forgot about the fact that the discussion is also going on in the Plotly community
Circular callbacks still do not work for me :\
ERROR: LoadError: LoadError: Circular input and output arguments were found. Please verify that callback outputs are not also input arguments.