Streamlit Shorts: Core Functionality Series

Hey Community :wave:t3:,

We’re excited to announce a new media format called Streamlit Shorts - these will be a series of short (~90 seconds or less) YouTube videos that are designed to make developing, designing and most importantly, learning about Streamlit easy. :partying_face::tada:

The goal is to create a series of videos that will allow new (and experienced!) users of Streamlit a new way to learn (or remember) how to use, create and debug some of the most common Streamlit functions. We know that people have many different learning styles, and we hope this will help those visual and interactive learners out there! :star_struck:

The first series is on Streamlit’s core functions and the first short on the button!

Check it out below: :heart_eyes:

:tv: Video:

:desktop_computer: Sample code:

import streamlit as st 

st.title("Making a Button")

result = st.button('Click Here')
st.write(result)

if result:
    st.write(":smile:")

The second video of the series goes into how to make a checkbox:

:tv: Video:

:desktop_computer: Sample code:

import streamlit as st

st.title("Making a Checkbox")

check = st.checkbox("Click here")
st.write('State of the checkbox:', check)

if check:
   st.write(":smile:"*12)

check_2 = st.checkbox("Uncheck to remove cake", value=True)
st.write("State of 2nd checkbox", check_2)

if check_2:
   st.write(":cake:"*102)

The third video of the series goes into how to make a set of radio buttons:

:tv: Video:

:desktop_computer: Sample code:

import streamlit as st

st.title("Make a Radio Button")

page_names = ['Checkbox', 'Button']

page = st.radio('Navigation', page_names, index=1)
st.write("**The variable 'page' returns:**", page)

if page == 'Checkbox':
   st.subheader('Welcome to the Checkbox page!')
   st.write("Nice to see you! :wave:")
else:
   st.subheader("Welcome to the Button page!")
   st.write(":thumbsup:")

The fourth video of the series goes into how to make a slider:

:tv: Video:

:desktop_computer: Sample code:

import streamlit as st
st.title(“Streamlit Sliders”)
st.subheader(“Slider 1:“)
x = st.slider(‘A number between 0-100’, value=50) # defaults to 0-100
st.write(“Slider number:“, x)
st.subheader(“Slider 2:“)
y = st.slider(‘Choose between 0-1 by 0.1’, min_value=0.0, max_value=1.0, step=0.1)
st.write(“Slider number:“, y)

The fifth video of the series goes into how to make a select slider:

:tv: Video:

:desktop_computer: Sample code:

import streamlit as st

st.title("Streamlit Select Sliders")

st.subheader("Using a python list:")
temp_options = ['low', 'medium','high']
temp = st.select_slider("Choose a temperature", options=temp_options)
st.write("The temperature of this :fire: is:", temp)

st.subheader("Using a python range:")
my_range = range(1,21)
number = st.select_slider("Choose a number", options=my_range, value=10)
st.write('You chose %s hearts:' %number, number*":heart:")

The sixth video of the series goes into how to make double sliders:

:tv: Video:

:desktop_computer: Sample code:

import streamlit as st

st.title("Streamlit Double Sliders")

st.subheader("Slider")
slider_range = st.slider("Double ended slider", value=[100,400])

st.info("Our slider range has type: %s" %type(slider_range))
st.write("Slider range:", slider_range, slider_range[0], slider_range[1])

st.subheader("Select Slider")
rainbow = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet']
start_clr, end_clr = st.select_slider("Select a range of colors from the rainbow",
    options=rainbow, value=('orange','indigo'))

st.info("Our colours have types: %s" %type(start_clr))
st.write('You chose:', start_clr, "to", end_clr)

Have functionality or a question you’d like to see covered in a short? Let us know below :balloon:

8 Likes

Looking forward to seeing how this content builds up in 2021! I think a lot of people will be drawn to bite-sized videos :partying_face:

1 Like

The second video of the series goes into how to make a checkbox:

:tv: Video:

:desktop_computer: Sample code:

import streamlit as st

st.title("Making a Checkbox")

check = st.checkbox("Click here")
st.write('State of the checkbox:', check)

if check:
   st.write(":smile:"*12)

check_2 = st.checkbox("Uncheck to remove cake", value=True)
st.write("State of 2nd checkbox", check_2)

if check_2:
   st.write(":cake:"*102)
3 Likes

The third video of the series goes into how to make a set of radio buttons:

:tv: Video:

:desktop_computer: Sample code:

import streamlit as st

st.title("Make a Radio Button")

page_names = ['Checkbox', 'Button']

page = st.radio('Navigation', page_names, index=1)
st.write("**The variable 'page' returns:**", page)

if page == 'Checkbox':
   st.subheader('Welcome to the Checkbox page!')
   st.write("Nice to see you! :wave:")
else:
   st.subheader("Welcome to the Button page!")
   st.write(":thumbsup:")
2 Likes

The fourth video of the series goes into how to make a slider:

:tv: Video:

:desktop_computer: Sample code:

import streamlit as st
st.title(“Streamlit Sliders”)
st.subheader(“Slider 1:“)
x = st.slider(‘A number between 0-100’, value=50) # defaults to 0-100
st.write(“Slider number:“, x)
st.subheader(“Slider 2:“)
y = st.slider(‘Choose between 0-1 by 0.1’, min_value=0.0, max_value=1.0, step=0.1)
st.write(“Slider number:“, y)
3 Likes

The fifth video of the series goes into how to make a select slider:

:tv: Video:

:desktop_computer: Sample code:

import streamlit as st

st.title("Streamlit Select Sliders")

st.subheader("Using a python list:")
temp_options = ['low', 'medium','high']
temp = st.select_slider("Choose a temperature", options=temp_options)
st.write("The temperature of this :fire: is:", temp)

st.subheader("Using a python range:")
my_range = range(1,21)
number = st.select_slider("Choose a number", options=my_range, value=10)
st.write('You chose %s hearts:' %number, number*":heart:")
3 Likes

The sixth video of the series goes into how to make double sliders:

:tv: Video:

:desktop_computer: Sample code:

import streamlit as st

st.title("Streamlit Double Sliders")

st.subheader("Slider")
slider_range = st.slider("Double ended slider", value=[100,400])

st.info("Our slider range has type: %s" %type(slider_range))
st.write("Slider range:", slider_range, slider_range[0], slider_range[1])

st.subheader("Select Slider")
rainbow = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet']
start_clr, end_clr = st.select_slider("Select a range of colors from the rainbow",
    options=rainbow, value=('orange','indigo'))

st.info("Our colours have types: %s" %type(start_clr))
st.write('You chose:', start_clr, "to", end_clr)
1 Like