Streamlit Super App library released (easy multipage, persistent state)

I’m really happy to have a community moderator feedback about this project. I hope this package gets more attention so more people could enjoy which i believe is a fun way to develop multiple applications in the same project.
Much love :heart:

1 Like

SHORT_DESCRIPTION, LONG_DESCRIPTION preferably. Or use TLDR for short description. Any other text is simply considered to be the long description and displayed if TLDR is omitted.

1 Like

Hi !
I have a question about your app, I tried to contact you on discord and on chat here but you seems busy, I hope you or someone else could answer me here.
Could you tell me how to implement a language selector via a selectbox using streamlit_superapp. The way I used before worked perfectly, but with streamlit_superapp it is more complicated. I’m using gettext and tried to associate it with your api (session_state/streamlit_superapp State.) but it didn’t work for now. Here is my code (in app.py):

import streamlit_superapp
from streamlit_superapp import State

import streamlit as st
import gettext
import os
def change_language():
    if (st.session_state.language_selectbox == "Nederlands"):
        st.session_state.selected_language = "du"
        lang = gettext.translation('dutch', os.path.normpath("workspace/langue"), languages=["du"])
        lang.install()        
        State('position_save').value = 1
    else:
        st.session_state.selected_language = "fr"
        lang = gettext.translation('francais', os.path.normpath("workspace/langue"), languages=["fr"])
        lang.install()
        State('position_save').value = 1
st.selectbox(
            _("Choisissez un langage"),
            ('Français', 'Nederlands'), index=State('position_save').value, on_change=change_language,
            key="language_selectbox")
st.set_page_config(page_title="RoboQOF", page_icon="workspace/ressources/icon.png")
streamlit_superapp.run()
State('position_save',default_value=0)

The only way that worked was to do this, but it’s not a selectbox and I wanted to use an UI:

if 'lang' not in st.session_state:
    st.session_state.lang=st.experimental_get_query_params()['lang'][0]
if st.session_state.lang=="du":
    lang = gettext.translation('dutch', os.path.normpath("workspace/langue"), languages=[st.session_state.lang])
else:
    lang = gettext.translation('francais', os.path.normpath("workspace/langue"), languages=[st.session_state.lang])
lang.install()

Hi, I developed an app using your library:

https://daltunay.streamlit.app/

1 Like

That’s a great example.