Add application file
Browse files- my_test.py +52 -0
my_test.py
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
|
| 3 |
+
st.title('Unit 5. Layouts & Containers')
|
| 4 |
+
st.caption('참조사이트: https://docs.streamlit.io/library/api-reference/layout')
|
| 5 |
+
|
| 6 |
+
# sidebar- with 사용하기 📧 📱 📞
|
| 7 |
+
with st.sidebar:
|
| 8 |
+
st.header('1. Sidebar')
|
| 9 |
+
|
| 10 |
+
add_selectbox = st.sidebar.selectbox('어떻게 연락드릴까요?',
|
| 11 |
+
('Email', 'Mobile', 'Ofice Phone')
|
| 12 |
+
)
|
| 13 |
+
if add_selectbox == 'Email':
|
| 14 |
+
st.sidebar.title('📧')
|
| 15 |
+
elif add_selectbox == 'Mobile':
|
| 16 |
+
st.sidebar.title('📱')
|
| 17 |
+
elif add_selectbox == 'Ofice Phone':
|
| 18 |
+
st.sidebar.title('📞')
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
# columns
|
| 22 |
+
Cat = 'https://images.pexels.com/photos/2071873/pexels-photo-2071873.jpeg?auto=compress&cs=tinysrgb'
|
| 23 |
+
Dog = 'https://images.pexels.com/photos/3361739/pexels-photo-3361739.jpeg?auto=compress&cs=tinysrgb'
|
| 24 |
+
Owl = 'https://images.pexels.com/photos/3737300/pexels-photo-3737300.jpeg?auto=compress&cs=tinysrgb'
|
| 25 |
+
|
| 26 |
+
st.header('2. Columns')
|
| 27 |
+
col1, col2, col3 = st.columns(3)
|
| 28 |
+
|
| 29 |
+
with col1:
|
| 30 |
+
st.text('Cat')
|
| 31 |
+
st.image(Cat)
|
| 32 |
+
with col2:
|
| 33 |
+
st.text('Dog')
|
| 34 |
+
st.image(Dog)
|
| 35 |
+
with col3:
|
| 36 |
+
st.text('Owl')
|
| 37 |
+
st.image(Owl)
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
# # tabs - width=200
|
| 41 |
+
st.header('3. Tabs')
|
| 42 |
+
tab1, tab2, tab3 = st.tabs(['Cat', 'Dog', 'Owl'])
|
| 43 |
+
|
| 44 |
+
with tab1:
|
| 45 |
+
st.text('Cat')
|
| 46 |
+
st.image(Cat, caption='This is a cat', width=300)
|
| 47 |
+
with tab2:
|
| 48 |
+
st.text('Dog')
|
| 49 |
+
st.image(Dog, caption='This is a dog', width=300)
|
| 50 |
+
with tab3:
|
| 51 |
+
st.text('Owl')
|
| 52 |
+
st.image(Owl, caption='This is an owl', width=300)
|