Empty a page in streamlit to show new contents

I’m actually working on my first streamlit application, and in projects_breakdowns Class i’m having some problems to correctly clear my panel to access to specific informations relatives to project clicked. I don’t understand what i’m doing wrong at this point. I’ve tried many different ways, red lots of documentations, but still can’t fix it. Can someone help please ? What i need to do is to be able to clear the whole page when i click on one of the buttons created by the Projects_Breakdowns.create_panels method, to be able to then display the informations relatives to the button clicked and the project linked to it. Thank’s in advance !

What i need to do is to be able to clear the whole page when i click on one of the buttons created by the Projects_Breakdowns.create_panels method, to be able to then display the informations relatives to the button clicked and the project linked to it. Thank’s in advance !

from pathlib import Path
import os
import streamlit as st
import streamlit_option_menu as stop
from PIL import Image
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
import pyautogui

THIS_DIR = Path(__file__).parent
CSS_FILE = THIS_DIR / "style" / "style.css"
ASSETS = THIS_DIR / "assets"
PROFIL = ASSETS / "profile-pic.png"

class Main_Interface():
    def __init__(self):
        super().__init__()
        st.set_page_config(layout="wide")

        self.about_me_widget = AboutMe_Widgets()
        self.contacts_widget = GetInTouch_Widgets()
        self.demoreel_widget = Demoreels_Widget()
        self.projects_breakdowns = Projects_Breakdowns()
        self.coding_dev = Coding_Dev()
        with open(CSS_FILE) as f:
            st.markdown(f"<style>{f.read()}</style>", unsafe_allow_html=True)

    def buttons(self):
        with st.sidebar:
            selected = stop.option_menu(
                menu_title = "Welcome !",
                options = ["About me","Get in touch","Demoreels","Projects breakdowns","Coding/Development"], # ,"Tutorials","Photography"
                icons = ["house","envelope","camera-reels-fill","list-stars","terminal-fill"], # ,"eyeglasses","camera-fill"
                menu_icon = "cast", 
                default_index = 0,
            )
        if selected == "About me":
            self.about_me_widget.create_panel()

        elif selected == "Get in touch":
            self.contacts_widget.create_panel()

        elif selected == "Demoreels":
            self.demoreel_widget.create_panel()

        elif selected == "Projects breakdowns":
            self.projects_breakdowns.create_panel()

        elif selected == "Coding/Development":
            self.coding_dev.create_panel()

class Projects_Breakdowns():
    def __init__(self):
        super().__init__()
        self.page_content_placeholder = st.empty()
        
    def create_panel(self):
        with self.page_content_placeholder.container():
            st.header('_PROJECTS BREAKDOWNS_ :', divider='red')
            project_date = os.listdir(PROJECTS_BREAKDOWNS)
            project_date.reverse()
            gray_image = Image.new("RGB", (384, 216))

            for year in project_date:
                st.subheader(f'_{year}_ :', divider='red')
                column_sets = st.columns(4)
                current_year = os.path.join(PROJECTS_BREAKDOWNS, year)

                for col, project in zip(column_sets, os.listdir(current_year)):
                    with col:
                        st.image(gray_image, use_column_width="always")
                        current_project = os.path.join(current_year, project)

                        if "details.txt" in os.listdir(current_project):
                            current_details = os.path.join(current_project, "details.txt")
                            current_details = current_details.replace("\\", "/")

                            with open(current_details, "r") as details:
                                loaded_details = details.read()

                            button_key = f"button{project}"
                            st.button(f"{project}", key=button_key, on_click=lambda: self.show_project_details(loaded_details, project))
        # self.page_content_placeholder.empty()

    def show_project_details(self, loaded_details, project):
        self.page_content_placeholder.empty()
        with self.page_content_placeholder.container():
            st.button("Restart", on_click=self.create_panel)
            st.title(f"About the project _{project}_ :")
            st.write(f"{loaded_details}")

if __name__ == "__main__":
    main_app = Main_Interface()
    main_app.buttons()