Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toggle Wide Mode #3878

Closed
thetoby9944 opened this issue Oct 6, 2021 · 2 comments
Closed

Toggle Wide Mode #3878

thetoby9944 opened this issue Oct 6, 2021 · 2 comments
Labels
status:awaiting-user-response Issue requires clarification from submitter type:enhancement Requests for feature enhancements or new features

Comments

@thetoby9944
Copy link

Problem

Cannot toggle layout

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

Solution

I can access the mode via the settings button - i.e. the checkbox for wide mode. It would be nicer if each page in the app can decide by itself if it wants to be in "wide" mode or "centred" - without the user having to manually adjust the page layout.

MVP:
Programmatically toggle the checkbox in the UI
e.g. st.toggle_layout()

Possible additions:
Add a flag to give a specific width in % or px for the layout

Preferred solution:
If we could nest columns that would be awesome, and I wouldn't need to fiddle with wide mode. I would create a parent column that can fit my whole page

@thetoby9944 thetoby9944 added type:enhancement Requests for feature enhancements or new features status:needs-triage Has not been triaged by the Streamlit team labels Oct 6, 2021
@vdonato
Copy link
Collaborator

vdonato commented Oct 28, 2021

Hi @thetoby9944, could you explain a bit more about what you're trying to do here, ideally with a small toy-app?

I think that st.set_page_config should give you enough flexibility to be able to toggle between wide and centered mode dynamically when switching between pages of a multi-page app. Since (if I'm remembering correctly) 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.

@vdonato vdonato added status:awaiting-user-response Issue requires clarification from submitter and removed status:needs-triage Has not been triaged by the Streamlit team labels Oct 28, 2021
@kmcgrady
Copy link
Collaborator

kmcgrady commented Dec 7, 2021

Closing due to inactivity, let us know if there are any issues.

@kmcgrady kmcgrady closed this as completed Dec 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:awaiting-user-response Issue requires clarification from submitter type:enhancement Requests for feature enhancements or new features
Projects
None yet
Development

No branches or pull requests

3 participants