create a streamlit application with a button; it needs to use CSS style to be in color blue and text in white, and when we press it, change the color to be yellow and text to be red. Also, after pressing the button, write the hello word text in the page.
To upload files, please first save the app
import streamlit as st
# Custom CSS to style the button
st.markdown("""
<style>
.custom-button {
background-color: blue;
color: white;
padding: 10px 20px;
border-radius: 5px;
border: none;
cursor: pointer;
}
.custom-button:active {
background-color: yellow !important;
color: red !important;
}
</style>
""", unsafe_allow_html=True)
# Create a container for the message
message_container = st.empty()
# Create the button using HTML/CSS
clicked = st.button(
"Click me!",
key="styled_button",
use_container_width=False
)
# Display message if button is clicked
if clicked:
st.write("Hello World!")
Hi! I can help you with any questions about Streamlit and Python. What would you like to know?