How to suppress output of widgets when using columns

Good day,

I am new to streamlit so I apologise in advance if this has already been covered.

When I use columns to neatly arrange input widgets (lets take a selectbox and number_input as example) the selection is automatically printed underneath the widget. Is there a way to suppress this output?

Thank you for the assistance!

Image to describe the problem:

Code used to create app:

import streamlit as st

st.title(‘How to suppress output of wigdets in columns’)

cols = st.columns(2)

with cols[0]:
st_sbox = st.selectbox(‘Left Column’, [‘Option 1’, ‘Option 2’])
cols[0].write(st_sbox)

with cols[1]:
st_niput = st.number_input(‘Right Column’)
cols[1].write(st_niput)

Hi @wimpiewest ,

You need to remove the code below,

The st.write function is used to print anything on your app. Henceforth, remove them !

Cheers
Avra

1 Like

Thanks for the reply @AvratanuBiswas!

That is exactly what I needed :slight_smile:

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.