#!/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"])