Streamlit in Python — Widgets, DataFrames and Charts
A single-file Streamlit example app in Python that demonstrates sidebar input widgets, a pandas DataFrame, a matplotlib histogram, and Streamlit’s native line and area charts — a quick way to learn how to build an interactive data web app without writing HTML or JavaScript.
Python projects · Interactive data apps
Start here
Read the requirements and any configuration below, then follow the usage example. Source paths below are relative to the repository root; run commands from the working directory stated in Usage. This example’s source is in Streamlit/Console_Code/. Install any third-party packages in an isolated Python environment.
Overview
This app serves as a showcase of Streamlit’s core capabilities. Users can interact with various sidebar controls, view their selections displayed in the main area, explore a dynamically generated data table, and see multiple chart types — all in a single-page web interface.
Features
- Sidebar widgets:
- Slider (age range selection)
- Text input (name)
- Selectbox (gender)
- Multiselect (hobbies)
- Date input (date of birth)
- Number input (salary)
- Checkbox (terms agreement)
- Radio buttons (feedback source)
- Main area:
- Display of all user inputs
- Dynamic DataFrame combining user input with sample data
- Age distribution histogram (matplotlib)
- Salary-vs-age line chart (Streamlit native)
- Salary-vs-age area chart (Streamlit native)
- Conditional “Show More Info” section via checkbox
Prerequisites and installation
streamlit
pandas
numpy
matplotlib
Install dependencies:
python -m pip install streamlit pandas numpy matplotlib
Usage
From the Console_Code folder:
streamlit run streamlit_app.py
If the above command does not work:
python -m streamlit run streamlit_app.py
Streamlit normally serves at http://localhost:8501; use the URL printed by the CLI if its configuration or available port differs. Browser opening depends on the runtime environment.
The age-range slider is displayed in the summary but does not filter the table. The entered name, gender, salary and hobbies populate one sample row; its age is regenerated randomly on each rerun. No persistence or authentication is implemented.
How Streamlit Runs the App
Streamlit re-runs the whole script from top to bottom every time a widget changes. Each widget call (for example st.sidebar.slider) returns its current value, so the page always reflects the latest inputs without callbacks.
Architecture
Streamlit/
└── Console_Code/
└── streamlit_app.py # Main Streamlit application
Related documentation
- Local AI chat app with Ollama and Streamlit
- WiFi Radar — Flask web dashboard
- Back to all Python projects
Documentation links
Read all Python Projects and Code Examples guides online · Project overview · All developer projects