New layout options for Streamlit

I have an use case where I want to display a pdf file on the left hand side and an html file having a sample extraction from the pdf on the right hand side. Presently it’s coming one below the other and I am unable to get them side by side. Is this possible in streamlit with the new horizontal layout option as I had been reading about? Waiting for an answer.

Hi @Myntur,

I don’t see any reasons why this wouldn’t work, once you create the columns you can use the with column_name notation:

import streamlit as st 

col1,col2 = st.beta_columns(2)

with col1: 
      #code for pdf

with col2: 
      #code for html
1 Like

Really helpful to understand Layouts and Best Practice to get workarounds. Gracias

1 Like

Is there an easy way to programmatically change the expanded state of a beta_expander to mimic the user clicking on it? For example, if I have a section of user entries in an expander and want to automatically fold the expander up once the user finishes that section, is that doable?

like fabio :+1: :+1: :+1:

Created a simple app and you can use KPIs from here

def create_kpi2():

temp = go.Figure(go.Indicator(
	mode = "number+delta",
	value = 492,
	delta = {"reference": 512, "valueformat": ".0f"},
	title = {"text": "Users online"},
	domain = {'y': [0, 1], 'x': [0.25, 0.75]}))

rand_count=random.randint(30,60)
rand_val=random.sample(range(10, rand_count+10), rand_count-1)

temp.add_trace(go.Scatter(
	y = rand_val, fill='tozeroy',fillcolor= 'whitesmoke'))

temp.update_layout(xaxis = {'range': [0, rand_count]},yaxis = {'range': [min(rand_val), max(rand_val)+100]})

temp.update_xaxes(showticklabels=False)
temp.update_yaxes(showticklabels=False)
temp.update_layout(Layout(
	paper_bgcolor='rgba(0,0,0,0)',
	plot_bgcolor='rgba(0,0,0,0)'
),autosize=False,width=500,height=300)

return temp
3 Likes