GameInsightify / module /__selectpage__.py
po5302006's picture
test on page selector
8ad83f6
raw
history blame
490 Bytes
import streamlit as st
from streamlit_extras.switch_page_button import switch_page
import os
pages = ["Overall"]
files = os.listdir('pages')
for name in files:
name = name.split()[1].replace('.py', '').replace('_', ' ')
pages.append(name)
def st_page_selectbox(current_page):
current_index = pages.index(current_page)
selected_page = st.selectbox("Select a category", pages, index=current_index)
if selected_page != current_page:
switch_page(selected_page)