Streamlit Multipages set default "wide layout"

Hello. Simple question, is there a way to set the default layout to “wide mode”?

I use “set_page_config” but because I can only use this on the main app.py, when i refresh or reload the browser tab (I’m using streamlit cloud) whilst I’m on another page other than app.py the layout wide mode is again reset. It’s fixed if I go back app.py and back to the other pages again. So, set_page_config is not cutting it. Can we make it so that the default layout is “wide” so i dont have to use set_page_config?

One other annoying thing about this during development is when i change something in my code and I’m not on app.py and streamlit autoreloads because of the changes in the code, it gives an error saying something like:

streamlit.errors.StreamlitAPIException: set_page_config() can only be called once per app

but i only have it on app.py. I think one thing that could fix this is a function that makes it so that when the code autoupdates or the browser tab is reloaded, because we have multipages, it should redirect back to app.py where it can find set_page_config (or at least a function we can use to manually redirect the page combined with session_states)

Thank you in advance

Hi @Shiro,

Thanks for posting!

st.set_page_config should enable you to toggle between wide and centered mode dynamically when switching between pages of a multi-page app. Since the function works nicely with callbacks, if you’re selecting a page in a multipage app using an st.selectbox , for example, you could call st.set_page_config with the desired layout argument within the callback to the widget depending on the page that you’re on.

Related GH issue where @vdonato explained the above

Caroline :balloon: