Closed khanfarhan10 closed 3 years ago
Hey @khanfarhan10,
While I could position the canvas to the center, I think this is something that should be solved at Streamlit's level rather than for every component, so let me raise the issue at their level.
In the meantime you can cheat by using column layout to push the canvas a little to the right:
import streamlit as st
from streamlit_drawable_canvas import st_canvas
canvas_css = """
.stMarkdown {
display: grid;
place-items: center;
}
"""
st.markdown(f'<style>{canvas_css}</style>', unsafe_allow_html=True) # to center title for reference
st.title("Center canvas")
col1, col2 = st.beta_columns((0.1,1))
with col2:
st_canvas()
Ahaaa using columns, right! Thanks!
In case the canvas does not span the full screen, I want the tool to be center aligned.