This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import streamlit as st | |
from persist import persist, load_widget_state | |
def main(): | |
if "page" not in st.session_state: | |
# Initialize session state. | |
st.session_state.update({ | |
# Default page. | |
"page": "home", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import streamlit as st | |
from streamlit.ReportThread import get_report_ctx | |
from streamlit.server.Server import Server | |
from threading import Thread | |
from time import sleep | |
def main(): | |
st.line_chart(random.sample(range(100), 20)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Patch to use callbacks with Streamlit custom components. | |
Usage | |
----- | |
>>> import streamlit.components.v1 as components | |
>>> from components_callbacks import register_callback | |
>>> | |
>>> print("Script begins...") | |
>>> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Restore Streamlit v0.88.0 session state behavior. | |
The legacy session state behavior allowed widget states to be persistent, | |
even after their disappearance. This can be handy when making a configurable | |
settings page. | |
Usage | |
----- | |
You must call the legacy_session_state() at the beginning of your script. |