streamlit-drawable-canvas icon indicating copy to clipboard operation
streamlit-drawable-canvas copied to clipboard

Page reloading continuously when st_canvas function is called.

Open sciprashanth96 opened this issue 1 year ago • 2 comments

Page keeps reloading automatically and randomly stops after 5-15 reloads whevenver st_canvas is called.

streamlit version: 1.25.0 (Tried 1.20.0, 1.23.0, 1.24.0 also does the same) streamlit-drawable-canvas version - 0.9.0 (tried with 0.7.0, 0.9.2 and 0.9.3 also. same problem)

This is highly crucial for our project

Trying to convert my plotly figure into an image and annotate on it

image = pio.to_image(fig)
img = Image.open(io.BytesIO(image))
cols = st.columns([4,1])
with cols[0]:
    tabs = st.tabs(['Plotly','Canvas'])
    with tabs[0]:
        plot_controls = st.container()
        with plot_controls:
            # Add config to fig
            config = ['drawline','drawopenpath','drawclosedpath','drawcircle','drawrect','eraseshape']
            fig.update_layout(modebar_add=config,height = 800,width = 800)
            st.plotly_chart(fig, use_container_width=True)    
        with tabs[1]:
            st_canvas(background_image = img)
            print('Canvas')
            uploaded_image = st.file_uploader('Upload Image',type=['png','jpg','jpeg'],key='uploaded_image'+function_code)

sciprashanth96 avatar Aug 02 '23 20:08 sciprashanth96

I've found the rootcasue of this problem for my side: the the problem is in empty container. If you have an empty container anywhere on the website this canvas wouldn't work

irumata avatar Sep 24 '23 21:09 irumata

Any progress on this? Very annoying issue

oneil512 avatar Feb 23 '24 23:02 oneil512