Closed GregVial closed 3 years ago
Hey @GregVial! Thanks for reaching.
Sorry for the delay. We've been thinking about ways to send events to Streamlit components, to enable for example sending a clear
command to the canvas without multiple reruns (example), but no solutions yet :confused: .
In the meantime, my only technique is to change the key
of the component to remount it from scratch. Maybe I could implement #7 so when you need to clear canvas you just upload a blank state, would that help you?
Fanilo
Thanks for the suggestion, and yes, implementing #7 works perfectly for me!
Hey @GregVial ! I did a release of Drawable Canvas 0.6.0. It contains a new "initial_drawing" argument you can use to supply your own canvas. It basically resets the canvas when you provide a new one so if you want you can supply {"random": fixed_number_to_increment, "background": "#eee"} to clean the canvas programmatically. The normal way of using it would be to save the json_data from a previous canvas and reload it through this argument. You could even edit this json to add your own objects if you are courageous. Check out https://github.com/andfanilo/streamlit-drawable-canvas-demo. Thanks for the support :)
Excellent, wil try it ASAP. Thanks so much for taking care of that :)
It would be great to be able to clear canva from a python command in addition to current available option using the GUI