Say I have a callback function that changes a Graph’s figure. Is it possible to decouple that callback from that Graph’s figure later, and even reassign another function as the callback to change Graph figure? Thanks.
Hi @mposcablo,
What kind of callback are you talking about? The on_change
, on_selection
, on_click
, on_hover
, and on_unhover
callback registration functions all include an optional append
argument. When append=False
(the default) each time a callback function is registered it replaces all previously registered callbacks. If append=True
then the new callback is added to the list of existing callbacks. And you can remove a callback by calling, for example, trace.on_selection(None)
.
Hope that helps!
-Jon
Hi @jmmease, can I do what you described in the Python Dash API? The ability to do what you just described is exactly what I need. However, looking at the dash.py
source on Github, I don’t see a way to set an append
parameter on callback()
.
Hi @mposcablo,
In Dash the callback definitions are defined in the application before the server starts and it’s not possible (at least not as far as I know) to modify them after the fact. If you want to talk about how to accomplish a particular workflow using Dash, I’d recommend describing a simple example of what you’re trying to do in a new forum post in the Dash category.
-Jon
Thanks @jmmease ! At least it’s clear to me now that this isn’t possible for now in Dash. I’ll describe what I ultimately want to do in a separate post when I get the chance.