Greetings
I want to know please if there is a method to get the path of the painted structure.
Even a regular shape( cercle)
Thanks.
Hi @saifedine, yes, you can! You can look at this tutorial for interaction with dcc.Graph
:
The summary is you can make a callback that listens to
relayoutData
, and this will contain the shape one just drew. For example, if you want to store the shapes in a store, you can do something like this:
@app.callback(
Output("my_store", "data"),
[Input("graph", "relayoutData")])
def react_to_drawing(graph_relayoutData):
data=[]
if graph_relayoutData and "shapes" in graph_relayoutData.keys():
# ... extract the shapes by looking in graph_relayoutData['shapes']
# .. generate data somehow, or just leave as [] to not return any data
return data