0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

folder_visualize

Last updated at Posted at 2024-06-26

import streamlit as st

def display_tree(tree, selected_folders=None, level=0):
    if selected_folders is None:
        selected_folders = []

    for key, value in tree.items():
        if isinstance(value, dict):
            checkbox = st.checkbox(f" " * 12 * level + f"📁 {key}", key=f"{key}_folder")
            if checkbox:
                selected_folders.append((key, level))
                display_tree(value, selected_folders, level + 1)
        else:
            st.write(" " * 12 * level + f"📄 {key}: {value}")
    
    return selected_folders

def main():

    st.header("Search Engine")
    st.multiselect('検索文字列を入れてください', options=['abc','efg'],)


    tab_all, tab1, tab2, tab3, = st.tabs(["all", "tab1", "tab2", "tab3"])

    with tab_all:
        
        st.write('hello')
    with tab1:
        st.subheader("tab1")
        st.header("A dog")
    with tab2:
        st.subheader("tab2")
        st.header("A dog")
    with tab3:
        st.subheader("tab3")
        st.header("A dog")
    
    directory_tree = {
        "category1": {
            "file1.txt": "https://en.wikipedia.org/wiki/Sushi",  # ファイルに空の値を設定
            "file2.txt": "",

        },
        "category2": {
            "file5.txt": "",
            "file6.txt": ""
        }
    }
    
    selected_folders = display_tree(directory_tree)

if __name__ == "__main__":
    main()



import json
import pathlib
import datetime
import time

# import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

import streamlit as st
import plotly.graph_objects as go
import plotly.express as px

import streamlit.components.v1 as components


def main():

    # ページ設定===========================================================================================================


    st.header("A dog")
    a = st.multiselect('検索文字列を入れてください', options=['abc','efg'],)
    b = st.multiselect('検索文字列を入れてください2', options=['abc','efg'],)

    directory_tree = {
        "category1": {
            "file1.txt": "https://en.wikipedia.org/wiki/Sushi",  # ファイルに空の値を設定
            "file2.txt": r"C:\Users\kaida\Desktop\weekend_python\env_gui1\myProject",

        },
        "category2": {
            "file5.txt": "",
            "file6.txt": ""
        }
    }

    # Wikipediaのリンク
    wikipedia_link = "https://ja.wikipedia.org/wiki/Python"
    st.markdown(f"[Wikipedia - Python]({wikipedia_link})")

    st.json(directory_tree)



    data_df = pd.DataFrame(
        {
            "apps": [
                "https://roadmap.streamlit.app",
                "https://extras.streamlit.app",
                "https://issues.streamlit.app",
                "https://30days.streamlit.app",
            ],
            "creator": [
                "https://github.com/streamlit",
                "https://github.com/arnaudmiribel",
                "https://github.com/streamlit",
                "https://github.com/streamlit",
            ],
        }
    )

    st.data_editor(
        data_df,
        column_config={
            "apps": st.column_config.LinkColumn(
                "Trending apps",
                help="The top trending Streamlit apps",
                validate="^https://[a-z]+\.streamlit\.app$",
                max_chars=100
            ),
            "creator": st.column_config.LinkColumn(
                "App Creator"
            ),
        },
        hide_index=True,
    )

    st.divider()



    # データフレームの初期化
    df = pd.DataFrame(
        [
            {'ID': '1', "x": 123, "y": 32, "sin": True, "aco": True, "shock": True, "comment": ''},
            {'ID': '2', "x": 334, "y": 124, "sin": False, "aco": True, "shock": True, "comment": ''},
            {'ID': '3', "x": 323, "y": 234, "sin": True, "aco": True, "shock": True, "comment": ''},
        ]
    )

    # Streamlitのデータエディタを使ってデータフレームを編集
    edited_df = st.data_editor(df, num_rows="dynamic")


if __name__ == '__main__':
    main()

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?