streamlit

Форк
0
/
typography.py 
94 строки · 1.9 Кб
1
# Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022-2024)
2
#
3
# Licensed under the Apache License, Version 2.0 (the "License");
4
# you may not use this file except in compliance with the License.
5
# You may obtain a copy of the License at
6
#
7
#     http://www.apache.org/licenses/LICENSE-2.0
8
#
9
# Unless required by applicable law or agreed to in writing, software
10
# distributed under the License is distributed on an "AS IS" BASIS,
11
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
# See the License for the specific language governing permissions and
13
# limitations under the License.
14

15
import streamlit as st
16

17

18
def draw_header_test(join_output):
19
    strings = [
20
        "# Header header",
21
        "## Header header",
22
        "### Header header",
23
        "#### Header header",
24
        "##### Header header",
25
        "###### Header header",
26
        "Quisque vel blandit mi. Fusce dignissim leo purus, in imperdiet lectus suscipit nec.",
27
    ]
28

29
    if join_output:
30
        st.write("\n\n".join(strings))
31
    else:
32
        for string in strings:
33
            st.write(string)
34

35

36
draw_header_test(True)
37

38
with st.sidebar:
39
    st.text_input("This is a label", key="1")
40
    draw_header_test(True)
41

42
"---"
43

44
st.text("Headers in single st.markdown")
45
draw_header_test(True)
46

47
"---"
48

49
st.text("Headers in multiple st.markdown")
50
draw_header_test(False)
51

52
"---"
53

54
st.text("Headers in columns")
55

56
a, b = st.columns(2)
57

58
with a:
59
    draw_header_test(True)
60

61
with b:
62
    draw_header_test(False)
63

64
"---"
65

66
st.text("Headers in columns with other elements above")
67

68
a, b = st.columns(2)
69

70
with a:
71
    st.text("This is some text")
72
    draw_header_test(True)
73

74
with b:
75
    st.text("This is some text")
76
    with st.container():
77
        draw_header_test(False)
78

79
"---"
80

81
st.text("Headers in column beside widget")
82

83
a, b = st.columns(2)
84

85
with a:
86
    st.write("# Header header")
87
    st.write("## Header header")
88

89
with b:
90
    st.text_input("This is a label", key="2")
91

92
"---"
93

94
st.text("End of page")
95

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.