Other goodies

But wait, there’s more!

Colored Expanders

More colors to your expander!!! You just have to start the expander header with the right keyword.

Echo

The same old echo function from streamlit, but with an additional boolean parameter to control whether the output is shown or not. Intended to be paired with a checkbox, as shown on the example.

echo(code_location='above', show=True)

Whether to show the echoed code before or after the results of the executed code block. :param code_location: “above” or “below” :type lines: str :param show: Boolean to show or hide the code block :type lines: bool :return: None :rtype: none Copied and improved from Streamlit’s github

Interactive example:

Share on Social Media

You can create share buttons for social media. This is based on the code I found at https://sharingbuttons.io/, which after a couple of hours of googling turned out to be the simplest way to share the content. Kudos to creator. It has some minor modifications, but it’s mostly a wrapping of the code for stremlit.

It requires as arguments the message and the url.

share(my_text, my_url)

This function takes a url and a text and displays clickable sharing buttons in html.

Parameters:
  • my_text (str) – the text to share on social media

  • my_url (str) – the url to share on social media