Skip to main content

Small handy widgets for streamlit, e.g. download button which won't cause rerun, set page width

Project description

streamlit-ext

PyPI Latest Release streamlit-ext-demo

A small handy extension for streamlit, keep your widget values in url, and share it with your friends.

Use widget from stramlit-ext just as streamlit and pass a unique key to it!

example gif

import numpy as np
import pandas as pd

import streamlit as st
import streamlit_ext as ste

df = pd.DataFrame(np.random.rand(10, 5))


option = ste.selectbox(
    "A form will show up if you select less than 10",
    range(100),
    key="selectbox",
)

st.write("You selected:", option)

age = ste.slider("How old are you?", 0, 130, 25, key="slider1")
st.write("I'm ", age, "years old")

ste.download_button("Click to download data!", df, "YOUR_DF.xlsx")
ste.download_button("Click to download text!", b"text content", "YOUR_STRING.txt")

installation

pip install streamlit-ext

Usage

sync widgets' value with urls

When widgets value changes, the url synced and if you open the url in new tab, every value keeped.

Just import widgets from streamlit_ext, and give a specific key argument to it!

import streamlit as st
import streamlit_ext as ste

from datetime import time, datetime, date

option = ste.selectbox(
    "How would you like to be contacted?",
    range(100),
    key="selectbox",
)

st.write("You selected:", option)

d = ste.date_input("When's your birthday", date(2019, 7, 6), key="date_input")
st.write("Your birthday is:", d)

t = ste.time_input("Set an alarm for", time(8, 45), key="time_input")
st.write("Alarm is set for", t)

Download button which won't cause rerun

import streamlit as st
import streamlit_ext as ste

st.title('streamlit-ext')

ste.set_page_width("60em")

ste.download_button("Download", "Hello World".encode(), "hello.txt")

Set page width

import streamlit as st
import streamlit_ext as ste

st.title('streamlit-ext')

ste.set_page_width("60em")

st.write("a quick fox jump..."*100)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

streamlit_ext-0.1.19.tar.gz (283.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

streamlit_ext-0.1.19-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file streamlit_ext-0.1.19.tar.gz.

File metadata

  • Download URL: streamlit_ext-0.1.19.tar.gz
  • Upload date:
  • Size: 283.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for streamlit_ext-0.1.19.tar.gz
Algorithm Hash digest
SHA256 af49b5947cff53060559684e472db8f90fe8139e27aa8a42d032248fccc4e9e6
MD5 941232f1ae38d489d5fd97bdaa484cc9
BLAKE2b-256 ed0c68bddc2843dcae507be5b9dfc0efe789ea113336f0bc78f44dead0a86245

See more details on using hashes here.

File details

Details for the file streamlit_ext-0.1.19-py3-none-any.whl.

File metadata

  • Download URL: streamlit_ext-0.1.19-py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for streamlit_ext-0.1.19-py3-none-any.whl
Algorithm Hash digest
SHA256 2d55cebfa7d5bb35067f7d1b362e94f1bc8a892151efc2eca99252e83af96cf2
MD5 6370c76e02e869baffbc8574d167a7d8
BLAKE2b-256 2c4061feb5351992cbbb71923f1448c73f5ba1c2226fc57519d51002b7f887e2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page