File size: 1,317 Bytes
e891f47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Project      : Python.
# @File         : 1001_多选组件
# @Time         : 2022/10/17 下午1:41
# @Author       : yuanjie
# @WeChat       : meutils
# @Software     : PyCharm
# @Description  : 

import streamlit as st
from streamlit_tree_select import tree_select
nodes = [
    {"label": "北京", "value": "北京"},
    {
        "label": "上海",
        "value": "上海",
        "children": [
            {"label": "浦东", "value": "浦东"},
            {"label": "杨浦", "value": "杨浦"},
            {"label": "虹口", "value": "虹口"},
            {"label": "黄浦", "value": "黄浦"},
        ],
    },
    {
        "label": "广州",
        "value": "广州",
        "children": [
            {"label": "番禺区", "value": "番禺区"},
            {
                "label": "白云区",
                "value": "白云区",
                "children": [
                    {"label": "三元里街", "value": "三元里街"},
                    {"label": "松洲街", "value": "松洲街"},
                ],
            },
            {"label": "珠江新区", "value": "珠江新区"},
        ],
    },
]

c1, c2 = st.columns(2)

with c1:

    return_select = tree_select(nodes)

with c2:
    st.write(return_select["checked"])