Anne31415 commited on
Commit
73d7e50
·
1 Parent(s): d698e7b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -9
app.py CHANGED
@@ -1,22 +1,34 @@
1
  import streamlit as st
2
 
3
- def cloud_button(label, key):
4
  button_html = f"""
5
- <div style="text-align: center; display: inline-block;">
6
- <div style="display: inline-flex; position: relative;">
7
- <div style="background-color: #FF6347; border-radius: 50%; width: 60px; height: 60px; margin: 5px;"></div>
8
- <div style="background-color: #FF6347; border-radius: 50%; width: 80px; height: 80px; margin: 5px; position: absolute; left: 30px; top: 10px;"></div>
9
- <div style="background-color: #FF6347; border-radius: 50%; width: 70px; height: 70px; margin: 5px; position: absolute; left: 70px;"></div>
 
 
 
 
10
  </div>
11
- <div style="margin-top: -50px;">{label}</div>
12
  </div>
13
  """
14
  st.markdown(button_html, unsafe_allow_html=True)
15
  return st.button("", key=key, use_container_width=True)
16
 
17
- if cloud_button("Click Me!", "button1"):
 
18
  st.success("Button 1 clicked!")
19
 
20
- if cloud_button("Another Button", "button2"):
21
  st.success("Button 2 clicked!")
22
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
 
3
+ def cloud_button(label, key, width):
4
  button_html = f"""
5
+ <div style="text-align: center; display: inline-block; width: {width}px;">
6
+ <div style="display: inline-flex; position: relative; background-color: #FF6347; border-radius: 50px; padding: 10px;">
7
+ <div style="border-radius: 50%; width: 50px; height: 50px; margin: 5px;"></div>
8
+ <div style="border-radius: 50%; width: 60px; height: 60px; margin: 5px; position: absolute; left: 20px;"></div>
9
+ <div style="border-radius: 50%; width: 70px; height: 70px; margin: 5px; position: absolute; left: 50px;"></div>
10
+ <div style="border-radius: 50%; width: 80px; height: 80px; margin: 5px; position: absolute; left: 90px;"></div>
11
+ <div style="border-radius: 50%; width: 70px; height: 70px; margin: 5px; position: absolute; left: 140px;"></div>
12
+ <div style="border-radius: 50%; width: 60px; height: 60px; margin: 5px; position: absolute; left: 180px;"></div>
13
+ <div style="border-radius: 50%; width: 50px; height: 50px; margin: 5px; position: absolute; left: 210px;"></div>
14
  </div>
15
+ <div style="margin-top: -40px; color: white; font-weight: bold;">{label}</div>
16
  </div>
17
  """
18
  st.markdown(button_html, unsafe_allow_html=True)
19
  return st.button("", key=key, use_container_width=True)
20
 
21
+ width = 300
22
+ if cloud_button("Click Me!", "button1", width):
23
  st.success("Button 1 clicked!")
24
 
25
+ if cloud_button("Another Button", "button2", width):
26
  st.success("Button 2 clicked!")
27
 
28
+ st.markdown(f"""
29
+ <div style="background-color: #FF6347; border-radius: 10px; padding: 10px; width: {width}px; color: white; text-align: center;">
30
+ This is a text field
31
+ </div>
32
+ """, unsafe_allow_html=True)
33
+
34
+