Skip to Main Content
Beginner's Guide to Streamlit with Python: Build Web-Based Data and Machine Learning Applications
book

Beginner's Guide to Streamlit with Python: Build Web-Based Data and Machine Learning Applications

by Sujay Raghavendra
December 2022
Beginner to intermediate content levelBeginner to intermediate
215 pages
3h 2m
English
Apress
Content preview from Beginner's Guide to Streamlit with Python: Build Web-Based Data and Machine Learning Applications
© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2023
S. RaghavendraBeginner's Guide to Streamlit with Python https://doi.org/10.1007/978-1-4842-8983-9_5

5. Buttons and Sliders

Sujay Raghavendra1  
(1)
Dharwad, Karnataka, India
 

In this chapter, we will discuss how to create different types of buttons. These buttons are a medium for interaction between the user and the application. Let’s start by creating these buttons one by one.

Buttons

A button is created by using the following syntax:
st.button('button_name')
Let’s create a button by using this syntax ; see Listing 5-1.
import streamlit as st
st.title('Creating a Button')
# Defining a Button
button = st.button('Click Here')
if button:
    st.write('You have clicked ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Machine Learning with Python Cookbook, 2nd Edition

Machine Learning with Python Cookbook, 2nd Edition

Kyle Gallatin, Chris Albon

Publisher Resources

ISBN: 9781484289839Purchase LinkPublisher Website