Streamlit Widgets
Source: 14-Streamlit/widgets.py
Start here — no coding background needed
What you will learn
Buttons, sliders, and inputs for interactive demos.
In simple words
Widgets collect user input and refresh the view.
Quick dashboards and demos — great for showing data without HTML/CSS.
Easy example — run this first. Change values and press Run again.
Runs in your browser via Pyodide — no server. First run may take a few seconds.
Reference notes (from full bootcamp)
Optional — deeper detail for when you are ready
Reference script from the bootcamp repo. Read the code below; run a simplified version in the playground when marked runnable.
import streamlit as st
import pandas as pd
st.title("Streamlit Text Input")
name=st.text_input("Enter your name:")
age=st.slider("Select your age:",0,100,25)
st.write(f"Your age is {age}.")
options = ["Python", "Java", "C++", "JavaScript"]
choice = st.selectbox("Choose your favorite language:", options)
st.write(f"You selected {choice}.")
if name:
st.write(f"Hello, {name}")
data = {
"Name": ["John", "Jane", "Jake", "Jill"],
"Age": [28, 24, 35, 40],
"City": ["New York", "Los Angeles", "Chicago", "Houston"]
}
df = pd.DataFrame(data)
df.to_csv("sampledata.csv")
st.write(df)
uploaded_file=st.file_uploader("Choose a CSV file",type="csv")
if uploaded_file is not None:
df=pd.read_csv(uploaded_file)
st.write(df)
Browser practice only — full example needs Python on your computer (files, Flask, threads, etc.).
Practice test — try yourself
Write code, press Check. Wrong answer shows the correct code to copy & run.
You learned "Streamlit Widgets". Use print() to show: Done: Streamlit Widgets
Hint: Use one print() with the exact text.