New layout columns

Hello guy!

First of all a big thank you for the layout update, it will be a very useful feature. Now that I was playing around with the columns I wondered if it possible to have columns in columns?

I tried the following but that did not work:
import streamlit as st

col1, col2 = st.beta_columns(2)
col1.write('I am base col1!')
col2.write('I am base col2!')

col_in_col1, col_in_col2 = st.beta_columns(2)


Hi @Thiemo_Seys, Welcome to the community !

I don’t think you can have nested columns or even expanders. Check this bit of code.

Can you describe your use case? Maybe we can explore an alternative way to achieve it?

I think we will have this functionality of nesting columns/expanders in future releases? @randyzwitch can you please comment on it?

Hope it helps!

Allright thanks for the help, I just noticed there is the following warning in the API reference:
Currently, you may not put columns inside another column.

I was planning to use it to stack buttons horizontally instead of vertically. The project is to display images in two columns, and then above the image display 3 buttons that change the color of the ‘attached’ image

Hey @Thiemo_Seys,
Sounds interesting, I just implemented this bit, I think you can easily substitute the working of 3 buttons with a selectbox. And it makes more sense to have a select box for filters I think as currently you have 3 colors in future you might have 100s. But its just my opinion i think,

It would look something like this if you choose to implement it this way,

Check this gist for code,


Thanks for the code example, using the selectbox for now and maybe changing it later to buttons when a new update releases is a decent fix for the moment.

One other question, if this needs to be posted in an other thread be sure to let me know.
Is it possible to use concurrent.futures.ThreadPoolExecutor in streamlit code to speed up the generating/rendering of images?

When I try to use it, i get the following error with the simple piece of code below:

 2020-10-15 15:24:33.471 Thread 'ThreadPoolExecutor-1_0': missing ReportContext


model_col1, model_col2 = st.beta_columns(2)
ids = [str(i) for i in dat_filtered[‘id’].tolist()]
row_indexes = [i for i in range(0,len(ids))]
from itertools import repeat

def test_threadpool(id, img_combiner, model_col, model_index, row_index):
    with model_col:

with ThreadPoolExecutor(max_workers=12) as exec:
    print('started loading images with threadpoolExe'), iter(ids),repeat(img_combiner), repeat(model_col1), repeat(0), 
#    print(f'using ids({len(ids)}): {ids} and row indexes({len(row_indexes)}: {row_indexes})')
#, iter(ids),repeat(img_combiner), repeat(model_col1), repeat(0), 
#, iter(ids),repeat(img_combiner2), repeat(model_col2), repeat(1), 

print('done running threadpool')

With my full code that generates the images I get no error or any output at all, nothings gets displayed either.