Anne31415's picture
Update app.py
73d7e50
raw
history blame
1.77 kB
import streamlit as st
def cloud_button(label, key, width):
button_html = f"""
<div style="text-align: center; display: inline-block; width: {width}px;">
<div style="display: inline-flex; position: relative; background-color: #FF6347; border-radius: 50px; padding: 10px;">
<div style="border-radius: 50%; width: 50px; height: 50px; margin: 5px;"></div>
<div style="border-radius: 50%; width: 60px; height: 60px; margin: 5px; position: absolute; left: 20px;"></div>
<div style="border-radius: 50%; width: 70px; height: 70px; margin: 5px; position: absolute; left: 50px;"></div>
<div style="border-radius: 50%; width: 80px; height: 80px; margin: 5px; position: absolute; left: 90px;"></div>
<div style="border-radius: 50%; width: 70px; height: 70px; margin: 5px; position: absolute; left: 140px;"></div>
<div style="border-radius: 50%; width: 60px; height: 60px; margin: 5px; position: absolute; left: 180px;"></div>
<div style="border-radius: 50%; width: 50px; height: 50px; margin: 5px; position: absolute; left: 210px;"></div>
</div>
<div style="margin-top: -40px; color: white; font-weight: bold;">{label}</div>
</div>
"""
st.markdown(button_html, unsafe_allow_html=True)
return st.button("", key=key, use_container_width=True)
width = 300
if cloud_button("Click Me!", "button1", width):
st.success("Button 1 clicked!")
if cloud_button("Another Button", "button2", width):
st.success("Button 2 clicked!")
st.markdown(f"""
<div style="background-color: #FF6347; border-radius: 10px; padding: 10px; width: {width}px; color: white; text-align: center;">
This is a text field
</div>
""", unsafe_allow_html=True)