44 lines
843 B
Python
44 lines
843 B
Python
import streamlit as st
|
|
|
|
|
|
def rerun(session_id=None):
|
|
if session_id is None:
|
|
session_id = get_session_id()
|
|
|
|
server = st.server.server.Server.get_current()
|
|
session = server._get_session_info(session_id).session
|
|
|
|
client_state = None
|
|
session.request_rerun(client_state)
|
|
|
|
|
|
|
|
def get_session_id():
|
|
ctx = st.scriptrunner.script_run_context.get_script_run_ctx()
|
|
return ctx.session_id
|
|
|
|
|
|
|
|
def hide_UI_elements(menu=True, header=True, footer=True):
|
|
HIDDEN = " {visibility: hidden;}"
|
|
res = []
|
|
|
|
if menu:
|
|
res.append("#MainMenu" + HIDDEN)
|
|
|
|
if header:
|
|
res.append("header" + HIDDEN)
|
|
|
|
if footer:
|
|
res.append("footer" + HIDDEN)
|
|
|
|
if not res:
|
|
return
|
|
|
|
res = ["<style>"] + res + ["</style>"]
|
|
res = "\n".join(res)
|
|
return st.markdown(res, unsafe_allow_html=True)
|
|
|
|
|
|
|