question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

New API: st.set_page_config

See original GitHub issue

Proposal

st.set_page_config(
	layout="centered",  # Can be "centered" or "wide". In the future also "dashboard", etc.
	initial_sidebar_state="auto",  # Can be "auto", "expanded", "collapsed"
	page_title=None,  # String or None. Strings get appended with "• Streamlit". 
	page_icon=None,  # String, anything supported by st.image, or None.
)

Background

We want to support the following in Streamlit:

  1. Ability to set page favicon
  2. Ability to set page title
  3. Ability to make a page start in wide mode (today you need to toggle it in “preferences”)
  4. Ability to make a page start with the sidebar collapsed (today you need to collapse via the UI)

Must be first st command

For all of these settings, we’d prefer if the user sets them near the top of their script. Because it would be weird to have an app load, then show a bunch of stuff, and then change into wide mode, for example.

Immutable, for now

For title and favicon, it makes a lot of sense to support mutation. But it’s not what 99% of the users will be doing, so it’s OK if we don’t support it at first. For wide-mode and expand-sidebar, mutations make a lot less sense.

(Copied from our internal spec here)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:12
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

14reactions
evavanrooijencommented, Feb 17, 2021

For anybody who arrived here and is looking for the fix:

streamlit.set_page_config(page_title=None, page_icon=None, layout=‘centered’, initial_sidebar_state=‘auto’)

Configures the default settings of the page. Note: This must be the first Streamlit command used in your app, and must only be set once. Parameters • page_title (str or None) – The page title, shown in the browser tab. If None, defaults to the filename of the script (“app.py” would show “app • Streamlit”). • page_icon (Anything supported by st.image or str or None) – The page favicon. Besides the types supported by st.image (like URLs or numpy arrays), you can pass in an emoji as a string (“”) or a shortcode (“🦈”). If you’re feeling lucky, try “random” for a random emoji! Emoji icons are courtesy of Twemoji and loaded from MaxCDN. • layout (“centered” or “wide”) – How the page content should be laid out. Defaults to “centered”, which constrains the elements into a centered column of fixed width; “wide” uses the entire screen. • initial_sidebar_state (“auto” or “expanded” or “collapsed”) – How the sidebar should start out. Defaults to “auto”, which hides the sidebar on mobilesized devices, and shows it otherwise. “expanded” shows the sidebar initially; “collapsed” hides it.

0reactions
karriebearcommented, Aug 13, 2020

Hi @benlindsay, sorry we had some issues with the nightly over the past weekend but we just shipped out a release yesterday so you should be able to use this feature if you upgrade to the latest Streamlit version(0.65)!

Read more comments on GitHub >

github_iconTop Results From Across the Web

st.set_page_config - Streamlit Docs
Configures the default settings of the page. Note. This must be the first Streamlit command used in your app, and must only be...
Read more >
Streamlit Pages Configuration - YouTube
Let's see how to deal with Streamlit pages configuration, Streamlit footer, burger menu, favicon, app title, etc.
Read more >
Street View Service | Maps JavaScript API - Google Developers
On this page ... When you add a Street View control to the map by setting its streetViewControl option to true ... const...
Read more >
API Reference Home | Zendesk Developer Docs
This is the complete collection of Zendesk APIs. Run in Postman. Capabilities. Ticketing. Work with tickets, users and organizations and manage ticket workflows ......
Read more >
Configure Grafana | Grafana documentation
Do not use environment variables to add new configuration settings. ... This setting also provides some protection against cross-site request forgery ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found