Is is possible i place a button or check box at any positon in the page?

Hi @apex_yu,

First I would like to say, welcome to the Streamlit community!!! :partying_face: :partying_face: :partying_face: :tada: :tada: :tada: :tada: :tada:

For your question, without knowing exactly what your trying to achieve (a minimum working example is encouraged when posting a question!) I would say Streamlit doesn’t have this function. The button only takes maximum of 2 arguments, one of which is the name you want to have on the button. Check out our documentation for more details. So you can’t pass in an x and y coordinate that corresponds to a position on your app.

However, there are ways to adjust the layout of your app, and to be able to put buttons and widgets in specific areas of the page (just not with pixel level precision). Here are some options you may want to try:

import streamlit as st

# to make your app take up all the available space in the browser window
# (not just a single column)
st.set_page_config(layout='wide')

st.title("Title of an app")

# you can create columns to better manage the flow of your page
# this command makes 3 columns of equal width
col1, col2, col3 = st.beta_columns(3)

# this will put a button in the middle column
with col2:
    st.button("I am a button")

st.write("Now on to the other columns")

# this command will make 3 columns of unequal width
# first column is largest and 3x the size of the last,
# second column is 2x the size of the last
col4, col5, col6 = st.beta_columns([3,2,1])

# this will put a checkbox in the last column
col6.checkbox("I am a checkbox")

This looks like:

If you want to know more checkout the docs on laying out your app or this post on layout:

New layout options for Streamlit

Happy Streamlit-ing!
Marisa

1 Like