Unable to bring up main application screen after streamlit welcome screen seperately

def login():
#interface codes for the login screen   
 global proceed
    if st.button('Proceed'):
         if proceed==1:
def main():
#interface codes for the main screen 

if __name__=='__main__' :

Hello friends, I have prepared two interface codes, the login screen, and the main screen. When I press the proceed button on the login screen, I want the login interface to disappear and only the main interface to appear.
When you press the proceed button in the current state of the code, both interfaces appear on one screen. I want only the main screen to appear when I press the proceed button. How can I solve this problem?
Could we use show hide: none css property for the login screen?
The login screen :

Hi @murat_tasci,

Here’s one way to accomplish this, using st.session_state to keep track of which page you’re trying to show

import streamlit as st

def login():
    # interface codes for the login screen
    st.write("Welcome to the login screen")
    global proceed
    if st.button("Proceed"):
        st.session_state["page"] = "main"

def main():
    # interface codes for the main screen
    st.write("Welcome to the main screen")

if "page" not in st.session_state:
    st.session_state["page"] = "login"

if st.session_state["page"] == "login":
elif st.session_state["page"] == "main":

You might also consider making this a multipage app Introducing multipage apps! 📄

1 Like