I don’t clearly understand how initial_drawing is working and I don’t found an explicit example of uses.
I store some data from drawable canvas in a csv (originX, originY, height,width …)
And i would like to know how it is possible to pre draw something from a line of this csv using initial_drawing (or other).
If someone could give me an example of initial_drawing expression without using a json. For example if i want to use :
initial_drawing = (x,y,height,width)
In fact my apply will recognize the pictures and pre draw the component that was stored for this image.
initial_drawing : Initialize canvas with drawings from here. Should be the json_data output from other canvas. Beware: if you try to import a drawing from a bigger/smaller canvas, no rescaling is done in the canvas and the import could fail.
Yes, the initial_drawing argument is usually used by people who export the JSON from a previous drawing and want to reload it later.
You can process your CSV into a Python dict though. If you need an example of structure, check out streamlit-drawable-canvas-demo/saved_state.json at master · andfanilo/streamlit-drawable-canvas-demo · GitHub or try to draw a rectangle, export the JSON and structure your CSV to JSON in a similar way
But yeah since different shapes have different JSON structures I can’t automatically map every CSV to its desired shape, so I let that transformation to the user
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.