streamlit-nightly 1.38.1.dev20240926__py2.py3-none-any.whl → 1.38.1.dev20240928__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- streamlit/commands/logo.py +22 -14
- streamlit/commands/navigation.py +12 -7
- streamlit/components/v1/component_registry.py +2 -2
- streamlit/components/v1/custom_component.py +2 -2
- streamlit/config.py +31 -9
- streamlit/elements/arrow.py +11 -9
- streamlit/elements/deck_gl_json_chart.py +134 -24
- streamlit/elements/empty.py +38 -13
- streamlit/elements/form.py +26 -8
- streamlit/elements/lib/column_types.py +14 -0
- streamlit/elements/plotly_chart.py +7 -7
- streamlit/elements/vega_charts.py +8 -8
- streamlit/elements/widgets/audio_input.py +13 -9
- streamlit/elements/widgets/button.py +25 -11
- streamlit/elements/widgets/button_group.py +3 -4
- streamlit/elements/widgets/camera_input.py +12 -8
- streamlit/elements/widgets/chat.py +3 -3
- streamlit/elements/widgets/checkbox.py +4 -6
- streamlit/elements/widgets/color_picker.py +3 -4
- streamlit/elements/widgets/data_editor.py +5 -4
- streamlit/elements/widgets/file_uploader.py +6 -7
- streamlit/elements/widgets/multiselect.py +3 -4
- streamlit/elements/widgets/number_input.py +3 -4
- streamlit/elements/widgets/radio.py +3 -4
- streamlit/elements/widgets/select_slider.py +3 -4
- streamlit/elements/widgets/selectbox.py +3 -4
- streamlit/elements/widgets/slider.py +3 -4
- streamlit/elements/widgets/text_widgets.py +6 -8
- streamlit/elements/widgets/time_widgets.py +6 -8
- streamlit/navigation/page.py +7 -5
- streamlit/runtime/state/common.py +0 -51
- streamlit/runtime/state/widgets.py +17 -53
- streamlit/static/asset-manifest.json +3 -3
- streamlit/static/index.html +1 -1
- streamlit/static/static/css/{5711.c24b25fa.chunk.css → 5711.a29b5d98.chunk.css} +1 -1
- streamlit/static/static/js/{main.45415ac9.js → main.db770de6.js} +2 -2
- streamlit/testing/v1/app_test.py +2 -2
- {streamlit_nightly-1.38.1.dev20240926.dist-info → streamlit_nightly-1.38.1.dev20240928.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.38.1.dev20240926.dist-info → streamlit_nightly-1.38.1.dev20240928.dist-info}/RECORD +44 -44
- /streamlit/static/static/js/{main.45415ac9.js.LICENSE.txt → main.db770de6.js.LICENSE.txt} +0 -0
- {streamlit_nightly-1.38.1.dev20240926.data → streamlit_nightly-1.38.1.dev20240928.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.38.1.dev20240926.dist-info → streamlit_nightly-1.38.1.dev20240928.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.38.1.dev20240926.dist-info → streamlit_nightly-1.38.1.dev20240928.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.38.1.dev20240926.dist-info → streamlit_nightly-1.38.1.dev20240928.dist-info}/top_level.txt +0 -0
streamlit/commands/logo.py
CHANGED
@@ -58,27 +58,35 @@ def logo(
|
|
58
58
|
sidebar. If ``icon_image`` is also provided, then Streamlit will only
|
59
59
|
display ``image`` in the sidebar.
|
60
60
|
|
61
|
-
Streamlit scales the image to a height
|
62
|
-
width
|
63
|
-
avoid distortion.
|
61
|
+
Streamlit scales the image to a max height set by ``size`` and a max
|
62
|
+
width to fit within the sidebar.
|
64
63
|
size: "small", "medium", or "large"
|
65
64
|
The size of the image displayed in the upper-left corner of the app and its
|
66
|
-
sidebar. The
|
65
|
+
sidebar. The possible values are as follows:
|
66
|
+
|
67
|
+
- ``"small"``: 20px max height
|
68
|
+
- ``"medium"`` (default): 24px max height
|
69
|
+
- ``"large"``: 32px max height
|
70
|
+
|
67
71
|
link : str or None
|
68
72
|
The external URL to open when a user clicks on the logo. The URL must
|
69
73
|
start with "\\http://" or "\\https://". If ``link`` is ``None`` (default),
|
70
74
|
the logo will not include a hyperlink.
|
71
75
|
icon_image: Anything supported by st.image or None
|
72
|
-
An
|
73
|
-
|
74
|
-
will
|
75
|
-
|
76
|
-
|
77
|
-
of the sidebar.
|
78
|
-
|
79
|
-
Streamlit scales the image to a height
|
80
|
-
width
|
81
|
-
|
76
|
+
An optional, typically smaller image to replace ``image`` in the
|
77
|
+
upper-left corner when the sidebar is closed. If ``icon_image`` is
|
78
|
+
``None`` (default), Streamlit will always display ``image`` in the
|
79
|
+
upper-left corner, regardless of whether the sidebar is open or closed.
|
80
|
+
Otherwise, Streamlit will render ``icon_image`` in the upper-left
|
81
|
+
corner of the app when the sidebar is closed.
|
82
|
+
|
83
|
+
Streamlit scales the image to a max height set by ``size`` and a max
|
84
|
+
width to fit within the sidebar. If the sidebar is closed, the max
|
85
|
+
width is retained from when it was last open.
|
86
|
+
|
87
|
+
For best results, pass a wide or horizontal image to ``image`` and a
|
88
|
+
square image to ``icon_image``. Or, pass a square image to ``image``
|
89
|
+
and leave ``icon_image=None``.
|
82
90
|
|
83
91
|
Examples
|
84
92
|
--------
|
streamlit/commands/navigation.py
CHANGED
@@ -82,7 +82,7 @@ def navigation(
|
|
82
82
|
|
83
83
|
Parameters
|
84
84
|
----------
|
85
|
-
pages: list[StreamlitPage] or dict[str, list[StreamlitPage]]
|
85
|
+
pages : list[StreamlitPage] or dict[str, list[StreamlitPage]]
|
86
86
|
The available pages for the app.
|
87
87
|
|
88
88
|
To create labeled sections or page groupings within the navigation
|
@@ -95,7 +95,7 @@ def navigation(
|
|
95
95
|
|
96
96
|
Use ``st.Page`` to create ``StreamlitPage`` objects.
|
97
97
|
|
98
|
-
position: "sidebar" or "hidden"
|
98
|
+
position : "sidebar" or "hidden"
|
99
99
|
The position of the navigation menu. If ``position`` is ``"sidebar"``
|
100
100
|
(default), the navigation widget appears at the top of the sidebar. If
|
101
101
|
``position`` is ``"hidden"``, the navigation widget is not displayed.
|
@@ -103,11 +103,16 @@ def navigation(
|
|
103
103
|
If there is only one page in ``pages``, the navigation will be hidden
|
104
104
|
for any value of ``position``.
|
105
105
|
|
106
|
-
expanded: bool
|
107
|
-
Whether the navigation menu should be expanded. If ``
|
108
|
-
the navigation menu will
|
109
|
-
|
110
|
-
|
106
|
+
expanded : bool
|
107
|
+
Whether the navigation menu should be expanded. If this is ``False``
|
108
|
+
(default), the navigation menu will be collapsed and will include a
|
109
|
+
button to view more options when there are too many pages to display.
|
110
|
+
If this is ``True``, the navigation menu will always be expanded; no
|
111
|
+
button to collapse the menu will be displayed.
|
112
|
+
|
113
|
+
If ``st.navigation`` changes from ``expanded=True`` to
|
114
|
+
``expanded=False`` on a rerun, the menu will stay expanded and a
|
115
|
+
collapse button will be displayed.
|
111
116
|
|
112
117
|
Returns
|
113
118
|
-------
|
@@ -73,13 +73,13 @@ def declare_component(
|
|
73
73
|
|
74
74
|
path: str or None
|
75
75
|
The path to serve the component's frontend files from. If ``path`` is
|
76
|
-
``None`` (default), Streamlit will
|
76
|
+
``None`` (default), Streamlit will serve the component from the
|
77
77
|
location in ``url``. Either ``path`` or ``url`` must be specified, but
|
78
78
|
not both.
|
79
79
|
|
80
80
|
url: str or None
|
81
81
|
The URL that the component is served from. If ``url`` is ``None``
|
82
|
-
(default), Streamlit will
|
82
|
+
(default), Streamlit will serve the component from the location in
|
83
83
|
``path``. Either ``path`` or ``url`` must be specified, but not both.
|
84
84
|
|
85
85
|
Returns
|
@@ -194,12 +194,12 @@ And if you're using Streamlit Cloud, add "pyarrow" to your requirements.txt."""
|
|
194
194
|
return ui_value
|
195
195
|
|
196
196
|
component_state = register_widget(
|
197
|
-
|
198
|
-
element_proto=element.component_instance,
|
197
|
+
element.component_instance.id,
|
199
198
|
deserializer=deserialize_component,
|
200
199
|
serializer=lambda x: x,
|
201
200
|
ctx=ctx,
|
202
201
|
on_change_handler=on_change,
|
202
|
+
value_type="json_value",
|
203
203
|
)
|
204
204
|
widget_value = component_state.value
|
205
205
|
|
streamlit/config.py
CHANGED
@@ -91,24 +91,38 @@ def set_option(key: str, value: Any, where_defined: str = _USER_DEFINED) -> None
|
|
91
91
|
|
92
92
|
|
93
93
|
def set_user_option(key: str, value: Any) -> None:
|
94
|
-
"""Set
|
94
|
+
"""Set a configuration option.
|
95
95
|
|
96
|
-
Currently, only
|
97
|
-
|
96
|
+
Currently, only ``client`` configuration options can be set within the
|
97
|
+
script itself:
|
98
98
|
|
99
|
-
|
99
|
+
- ``client.showErrorDetails``
|
100
|
+
- ``client.showSidebarNavigation``
|
101
|
+
- ``client.toolbarMode``
|
100
102
|
|
101
|
-
|
103
|
+
Calling ``st.set_option`` with any other option will raise a
|
104
|
+
``StreamlitAPIException``. When changing a configuration option in a
|
105
|
+
running app, you may need to trigger a rerun after changing the option to
|
106
|
+
see the effects.
|
107
|
+
|
108
|
+
Run ``streamlit config show`` in a terminal to see all available options.
|
102
109
|
|
103
110
|
Parameters
|
104
111
|
----------
|
105
112
|
key : str
|
106
113
|
The config option key of the form "section.optionName". To see all
|
107
|
-
available options, run
|
114
|
+
available options, run ``streamlit config show`` in a terminal.
|
108
115
|
|
109
116
|
value
|
110
117
|
The new value to assign to this config option.
|
111
118
|
|
119
|
+
Example
|
120
|
+
-------
|
121
|
+
|
122
|
+
>>> import streamlit as st
|
123
|
+
>>>
|
124
|
+
>>> st.set_option("client.showErrorDetails", True)
|
125
|
+
|
112
126
|
"""
|
113
127
|
try:
|
114
128
|
opt = _config_options_template[key]
|
@@ -124,15 +138,23 @@ def set_user_option(key: str, value: Any) -> None:
|
|
124
138
|
|
125
139
|
|
126
140
|
def get_option(key: str) -> Any:
|
127
|
-
"""Return the current value of a given Streamlit
|
141
|
+
"""Return the current value of a given Streamlit configuration option.
|
128
142
|
|
129
|
-
Run
|
143
|
+
Run ``streamlit config show`` in a terminal to see all available options.
|
130
144
|
|
131
145
|
Parameters
|
132
146
|
----------
|
133
147
|
key : str
|
134
148
|
The config option key of the form "section.optionName". To see all
|
135
|
-
available options, run
|
149
|
+
available options, run ``streamlit config show`` in a terminal.
|
150
|
+
|
151
|
+
Example
|
152
|
+
-------
|
153
|
+
|
154
|
+
>>> import streamlit as st
|
155
|
+
>>>
|
156
|
+
>>> color = st.get_option("theme.primaryColor")
|
157
|
+
|
136
158
|
"""
|
137
159
|
with _config_lock:
|
138
160
|
config_options = get_config_options()
|
streamlit/elements/arrow.py
CHANGED
@@ -78,7 +78,7 @@ class DataframeSelectionState(TypedDict, total=False):
|
|
78
78
|
"""
|
79
79
|
The schema for the dataframe selection state.
|
80
80
|
|
81
|
-
The selection state is stored in a dictionary-like object that
|
81
|
+
The selection state is stored in a dictionary-like object that supports both
|
82
82
|
key and attribute notation. Selection states cannot be programmatically
|
83
83
|
changed or set through Session State.
|
84
84
|
|
@@ -136,7 +136,7 @@ class DataframeState(TypedDict, total=False):
|
|
136
136
|
"""
|
137
137
|
The schema for the dataframe event state.
|
138
138
|
|
139
|
-
The event state is stored in a dictionary-like object that
|
139
|
+
The event state is stored in a dictionary-like object that supports both
|
140
140
|
key and attribute notation. Event states cannot be programmatically
|
141
141
|
changed or set through Session State.
|
142
142
|
|
@@ -145,7 +145,7 @@ class DataframeState(TypedDict, total=False):
|
|
145
145
|
Attributes
|
146
146
|
----------
|
147
147
|
selection : dict
|
148
|
-
The state of the ``on_select`` event. This
|
148
|
+
The state of the ``on_select`` event. This attribute returns a
|
149
149
|
dictionary-like object that supports both key and attribute notation.
|
150
150
|
The attributes are described by the ``DataframeSelectionState``
|
151
151
|
dictionary schema.
|
@@ -295,7 +295,7 @@ class ArrowMixin:
|
|
295
295
|
- ``snowflake.snowpark.dataframe.DataFrame``,
|
296
296
|
``snowflake.snowpark.table.Table``
|
297
297
|
|
298
|
-
If a
|
298
|
+
If a data type is not recognized, Streamlit will convert the object
|
299
299
|
to a ``pandas.DataFrame`` or ``pyarrow.Table`` using a
|
300
300
|
``.to_pandas()`` or ``.to_arrow()`` method, respectively, if
|
301
301
|
available.
|
@@ -304,7 +304,9 @@ class ArrowMixin:
|
|
304
304
|
underlying ``pandas.DataFrame``. Streamlit supports custom cell
|
305
305
|
values and colors. It does not support some of the more exotic
|
306
306
|
styling options, like bar charts, hovering, and captions. For
|
307
|
-
these styling options, use column configuration instead.
|
307
|
+
these styling options, use column configuration instead. Text and
|
308
|
+
number formatting from ``column_config`` always takes precedence
|
309
|
+
over text and number formatting from ``pandas.Styler``.
|
308
310
|
|
309
311
|
Collection-like objects include all Python-native ``Collection``
|
310
312
|
types, such as ``dict``, ``list``, and ``set``.
|
@@ -417,9 +419,9 @@ class ArrowMixin:
|
|
417
419
|
Returns
|
418
420
|
-------
|
419
421
|
element or dict
|
420
|
-
If ``on_select`` is ``"ignore"`` (default), this
|
422
|
+
If ``on_select`` is ``"ignore"`` (default), this command returns an
|
421
423
|
internal placeholder for the dataframe element that can be used
|
422
|
-
with the ``.add_rows()`` method. Otherwise, this
|
424
|
+
with the ``.add_rows()`` method. Otherwise, this command returns a
|
423
425
|
dictionary-like object that supports both key and attribute
|
424
426
|
notation. The attributes are described by the ``DataframeState``
|
425
427
|
dictionary schema.
|
@@ -581,12 +583,12 @@ class ArrowMixin:
|
|
581
583
|
|
582
584
|
serde = DataframeSelectionSerde()
|
583
585
|
widget_state = register_widget(
|
584
|
-
|
585
|
-
proto,
|
586
|
+
proto.id,
|
586
587
|
on_change_handler=on_select if callable(on_select) else None,
|
587
588
|
deserializer=serde.deserialize,
|
588
589
|
serializer=serde.serialize,
|
589
590
|
ctx=ctx,
|
591
|
+
value_type="string_value",
|
590
592
|
)
|
591
593
|
self.dg._enqueue("arrow_data_frame", proto)
|
592
594
|
return cast(DataframeState, widget_state.value)
|
@@ -101,17 +101,106 @@ def parse_selection_mode(
|
|
101
101
|
|
102
102
|
|
103
103
|
class PydeckSelectionState(TypedDict, total=False):
|
104
|
-
"""
|
105
|
-
The schema for the PyDeck
|
104
|
+
r"""
|
105
|
+
The schema for the PyDeck chart selection state.
|
106
|
+
|
107
|
+
The selection state is stored in a dictionary-like object that supports
|
108
|
+
both key and attribute notation. Selection states cannot be
|
109
|
+
programmatically changed or set through Session State.
|
110
|
+
|
111
|
+
You must define ``id`` in ``pydeck.Layer`` to ensure statefulness when
|
112
|
+
using selections with ``st.pydeck_chart``.
|
106
113
|
|
107
114
|
Attributes
|
108
115
|
----------
|
109
116
|
indices : dict[str, list[int]]
|
110
|
-
|
111
|
-
of
|
117
|
+
A dictionary of selected objects by layer. Each key in the dictionary
|
118
|
+
is a layer id, and each value is a list of object indices within that
|
119
|
+
layer.
|
112
120
|
objects : dict[str, list[dict[str, Any]]]
|
113
|
-
|
114
|
-
|
121
|
+
A dictionary of object attributes by layer. Each key in the dictionary
|
122
|
+
is a layer id, and each value is a list of metadata dictionaries for
|
123
|
+
the selected objects in that layer.
|
124
|
+
|
125
|
+
Examples
|
126
|
+
--------
|
127
|
+
The following example has multi-object selection enabled. The chart
|
128
|
+
displays US state capitals by population (2023 US Census estimate). You
|
129
|
+
can access this `data
|
130
|
+
<https://github.com/streamlit/docs/blob/main/python/api-examples-source/data/capitals.csv>`_
|
131
|
+
from GitHub.
|
132
|
+
|
133
|
+
>>> import streamlit as st
|
134
|
+
>>> import pydeck
|
135
|
+
>>> import pandas as pd
|
136
|
+
>>>
|
137
|
+
>>> capitals = pd.read_csv(
|
138
|
+
... "capitals.csv",
|
139
|
+
... header=0,
|
140
|
+
... names=[
|
141
|
+
... "Capital",
|
142
|
+
... "State",
|
143
|
+
... "Abbreviation",
|
144
|
+
... "Latitude",
|
145
|
+
... "Longitude",
|
146
|
+
... "Population",
|
147
|
+
... ],
|
148
|
+
... )
|
149
|
+
>>> capitals["size"] = capitals.Population / 10
|
150
|
+
>>>
|
151
|
+
>>> point_layer = pydeck.Layer(
|
152
|
+
... "ScatterplotLayer",
|
153
|
+
... data=capitals,
|
154
|
+
... id="capital-cities",
|
155
|
+
... get_position=["Longitude", "Latitude"],
|
156
|
+
... get_color="[255, 75, 75]",
|
157
|
+
... pickable=True,
|
158
|
+
... auto_highlight=True,
|
159
|
+
... get_radius="size",
|
160
|
+
... )
|
161
|
+
>>>
|
162
|
+
>>> view_state = pydeck.ViewState(
|
163
|
+
... latitude=40, longitude=-117, controller=True, zoom=2.4, pitch=30
|
164
|
+
... )
|
165
|
+
>>>
|
166
|
+
>>> chart = pydeck.Deck(
|
167
|
+
... point_layer,
|
168
|
+
... initial_view_state=view_state,
|
169
|
+
... tooltip={"text": "{Capital}, {Abbreviation}\nPopulation: {Population}"},
|
170
|
+
... )
|
171
|
+
>>>
|
172
|
+
>>> event = st.pydeck_chart(chart, on_select="rerun", selection_mode="multi-object")
|
173
|
+
>>>
|
174
|
+
>>> event.selection
|
175
|
+
|
176
|
+
.. output ::
|
177
|
+
https://doc-pydeck-event-state-selections.streamlit.app/
|
178
|
+
height: 700px
|
179
|
+
|
180
|
+
This is an example of the selection state when selecting a single object
|
181
|
+
from a layer with id, ``"captial-cities"``:
|
182
|
+
|
183
|
+
>>> {
|
184
|
+
>>> "indices":{
|
185
|
+
>>> "capital-cities":[
|
186
|
+
>>> 2
|
187
|
+
>>> ]
|
188
|
+
>>> },
|
189
|
+
>>> "objects":{
|
190
|
+
>>> "capital-cities":[
|
191
|
+
>>> {
|
192
|
+
>>> "Abbreviation":" AZ"
|
193
|
+
>>> "Capital":"Phoenix"
|
194
|
+
>>> "Latitude":33.448457
|
195
|
+
>>> "Longitude":-112.073844
|
196
|
+
>>> "Population":1650070
|
197
|
+
>>> "State":" Arizona"
|
198
|
+
>>> "size":165007.0
|
199
|
+
>>> }
|
200
|
+
>>> ]
|
201
|
+
>>> }
|
202
|
+
>>> }
|
203
|
+
|
115
204
|
"""
|
116
205
|
|
117
206
|
indices: dict[str, list[int]]
|
@@ -120,12 +209,22 @@ class PydeckSelectionState(TypedDict, total=False):
|
|
120
209
|
|
121
210
|
class PydeckState(TypedDict, total=False):
|
122
211
|
"""
|
123
|
-
The schema for the PyDeck
|
212
|
+
The schema for the PyDeck event state.
|
213
|
+
|
214
|
+
The event state is stored in a dictionary-like object that supports both
|
215
|
+
key and attribute notation. Event states cannot be programmatically changed
|
216
|
+
or set through Session State.
|
217
|
+
|
218
|
+
Only selection events are supported at this time.
|
124
219
|
|
125
220
|
Attributes
|
126
221
|
----------
|
127
|
-
selection :
|
128
|
-
The
|
222
|
+
selection : dict
|
223
|
+
The state of the ``on_select`` event. This attribute returns a
|
224
|
+
dictionary-like object that supports both key and attribute notation.
|
225
|
+
The attributes are described by the ``PydeckSelectionState``
|
226
|
+
dictionary schema.
|
227
|
+
|
129
228
|
"""
|
130
229
|
|
131
230
|
selection: PydeckSelectionState
|
@@ -251,28 +350,30 @@ class PydeckMixin:
|
|
251
350
|
``None`` (default), Streamlit sets the height of the chart to fit
|
252
351
|
its contents according to the plotting library.
|
253
352
|
on_select : "ignore" or "rerun" or callable
|
254
|
-
How the
|
255
|
-
whether or not the
|
353
|
+
How the figure should respond to user selection events. This controls
|
354
|
+
whether or not the chart behaves like an input widget.
|
256
355
|
``on_select`` can be one of the following:
|
257
356
|
|
258
357
|
- ``"ignore"`` (default): Streamlit will not react to any selection
|
259
|
-
events in the
|
358
|
+
events in the chart. The figure will not behave like an
|
260
359
|
input widget.
|
261
|
-
- ``"rerun"``:
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
360
|
+
- ``"rerun"``: Streamlit will rerun the app when the user selects
|
361
|
+
data in the chart. In this case, ``st.pydeck_chart`` will return
|
362
|
+
the selection data as a dictionary.
|
363
|
+
- A ``callable``: Streamlit will rerun the app and execute the callable
|
364
|
+
as a callback function before the rest of the app. In this case,
|
365
|
+
``st.pydeck_chart`` will return the selection data as a
|
366
|
+
dictionary.
|
367
|
+
|
368
|
+
If ``on_select`` is not ``"ignore"``, all layers must have a
|
369
|
+
declared ``id`` to keep the chart stateful across reruns.
|
269
370
|
selection_mode : "single-object" or "multi-object"
|
270
|
-
The
|
271
|
-
the following:
|
371
|
+
The selection mode of the chart. This can be one of the following:
|
272
372
|
|
273
373
|
- ``"single-object"`` (default): Only one object can be selected at
|
274
374
|
a time.
|
275
375
|
- ``"multi-object"``: Multiple objects can be selected at a time.
|
376
|
+
|
276
377
|
key : str
|
277
378
|
An optional string to use for giving this element a stable
|
278
379
|
identity. If ``key`` is ``None`` (default), this element's identity
|
@@ -282,6 +383,15 @@ class PydeckMixin:
|
|
282
383
|
Streamlit will register the key in Session State to store the
|
283
384
|
selection state. The selection state is read-only.
|
284
385
|
|
386
|
+
Returns
|
387
|
+
-------
|
388
|
+
element or dict
|
389
|
+
If ``on_select`` is ``"ignore"`` (default), this command returns an
|
390
|
+
internal placeholder for the chart element. Otherwise, this method
|
391
|
+
returns a dictionary-like object that supports both key and
|
392
|
+
attribute notation. The attributes are described by the
|
393
|
+
``PydeckState`` dictionary schema.
|
394
|
+
|
285
395
|
Example
|
286
396
|
-------
|
287
397
|
Here's a chart using a HexagonLayer and a ScatterplotLayer. It uses either the
|
@@ -399,12 +509,12 @@ class PydeckMixin:
|
|
399
509
|
serde = PydeckSelectionSerde()
|
400
510
|
|
401
511
|
widget_state = register_widget(
|
402
|
-
|
403
|
-
pydeck_proto,
|
512
|
+
pydeck_proto.id,
|
404
513
|
ctx=ctx,
|
405
514
|
deserializer=serde.deserialize,
|
406
515
|
on_change_handler=on_select if callable(on_select) else None,
|
407
516
|
serializer=serde.serialize,
|
517
|
+
value_type="string_value",
|
408
518
|
)
|
409
519
|
|
410
520
|
self.dg._enqueue("deck_gl_json_chart", pydeck_proto)
|
streamlit/elements/empty.py
CHANGED
@@ -39,37 +39,62 @@ class EmptyMixin:
|
|
39
39
|
|
40
40
|
Examples
|
41
41
|
--------
|
42
|
-
|
42
|
+
Inside a ``with st.empty():`` block, each displayed element will
|
43
|
+
replace the previous one.
|
43
44
|
|
44
45
|
>>> import streamlit as st
|
45
46
|
>>> import time
|
46
47
|
>>>
|
47
48
|
>>> with st.empty():
|
48
|
-
... for seconds in range(
|
49
|
+
... for seconds in range(10):
|
49
50
|
... st.write(f"⏳ {seconds} seconds have passed")
|
50
51
|
... time.sleep(1)
|
51
|
-
... st.write("
|
52
|
+
... st.write(":material/check: 10 seconds over!")
|
53
|
+
... st.button("Rerun")
|
52
54
|
|
53
|
-
|
55
|
+
.. output::
|
56
|
+
https://doc-empty.streamlit.app/
|
57
|
+
height: 220px
|
58
|
+
|
59
|
+
You can use an ``st.empty`` to replace multiple elements in
|
60
|
+
succession. Use ``st.container`` inside ``st.empty`` to display (and
|
61
|
+
later replace) a group of elements.
|
54
62
|
|
55
63
|
>>> import streamlit as st
|
64
|
+
>>> import time
|
56
65
|
>>>
|
57
|
-
>>>
|
66
|
+
>>> st.button("Start over")
|
58
67
|
>>>
|
59
|
-
>>>
|
60
|
-
>>> placeholder.
|
68
|
+
>>> placeholder = st.empty()
|
69
|
+
>>> placeholder.markdown("Hello")
|
70
|
+
>>> time.sleep(1)
|
61
71
|
>>>
|
62
|
-
>>>
|
63
|
-
>>>
|
72
|
+
>>> placeholder.progress(0, "Wait for it...")
|
73
|
+
>>> time.sleep(1)
|
74
|
+
>>> placeholder.progress(50, "Wait for it...")
|
75
|
+
>>> time.sleep(1)
|
76
|
+
>>> placeholder.progress(100, "Wait for it...")
|
77
|
+
>>> time.sleep(1)
|
64
78
|
>>>
|
65
|
-
>>> # Replace the chart with several elements:
|
66
79
|
>>> with placeholder.container():
|
67
|
-
... st.
|
68
|
-
...
|
80
|
+
... st.line_chart({"data": [1, 5, 2, 6]})
|
81
|
+
... time.sleep(1)
|
82
|
+
... st.markdown("3...")
|
83
|
+
... time.sleep(1)
|
84
|
+
... st.markdown("2...")
|
85
|
+
... time.sleep(1)
|
86
|
+
... st.markdown("1...")
|
87
|
+
... time.sleep(1)
|
88
|
+
>>>
|
89
|
+
>>> placeholder.markdown("Poof!")
|
90
|
+
>>> time.sleep(1)
|
69
91
|
>>>
|
70
|
-
>>> # Clear all those elements:
|
71
92
|
>>> placeholder.empty()
|
72
93
|
|
94
|
+
.. output::
|
95
|
+
https://doc-empty-placeholder.streamlit.app/
|
96
|
+
height: 600px
|
97
|
+
|
73
98
|
"""
|
74
99
|
empty_proto = EmptyProto()
|
75
100
|
return self.dg._enqueue("empty", empty_proto)
|
streamlit/elements/form.py
CHANGED
@@ -100,7 +100,19 @@ class FormMixin:
|
|
100
100
|
will not be reset to their defaults on form submission.)
|
101
101
|
enter_to_submit : bool
|
102
102
|
Whether to submit the form when a user presses Enter while
|
103
|
-
interacting with a widget inside the form.
|
103
|
+
interacting with a widget inside the form.
|
104
|
+
|
105
|
+
If this is ``True`` (default), pressing Enter while interacting
|
106
|
+
with a form widget is equivalent to clicking the first
|
107
|
+
``st.form_submit_button`` in the form.
|
108
|
+
|
109
|
+
If this is ``False``, the user must click an
|
110
|
+
``st.form_submit_button`` to submit the form.
|
111
|
+
|
112
|
+
If the first ``st.form_submit_button`` in the form is disabled,
|
113
|
+
the form will override submission behavior with
|
114
|
+
``enter_to_submit=False``.
|
115
|
+
|
104
116
|
border : bool
|
105
117
|
Whether to show a border around the form. Defaults to True.
|
106
118
|
|
@@ -193,13 +205,13 @@ class FormMixin:
|
|
193
205
|
"""Display a form submit button.
|
194
206
|
|
195
207
|
When this button is clicked, all widget values inside the form will be
|
196
|
-
sent to Streamlit in a batch.
|
208
|
+
sent from the user's browser to your Streamlit server in a batch.
|
197
209
|
|
198
|
-
Every form must have
|
199
|
-
cannot exist outside a form.
|
210
|
+
Every form must have at least one ``st.form_submit_button``. An
|
211
|
+
``st.form_submit_button`` cannot exist outside of a form.
|
200
212
|
|
201
|
-
For more information about forms, check out our
|
202
|
-
|
213
|
+
For more information about forms, check out our `docs
|
214
|
+
<https://docs.streamlit.io/develop/concepts/architecture/forms>`_.
|
203
215
|
|
204
216
|
Parameters
|
205
217
|
----------
|
@@ -236,8 +248,14 @@ class FormMixin:
|
|
236
248
|
<https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Rounded>`_
|
237
249
|
font library.
|
238
250
|
disabled : bool
|
239
|
-
|
240
|
-
|
251
|
+
Whether to disable the button. If this is ``False`` (default), the
|
252
|
+
user can interact with the button. If this is ``True``, the button
|
253
|
+
is grayed-out and can't be clicked.
|
254
|
+
|
255
|
+
If the first ``st.form_submit_button`` in the form is disabled,
|
256
|
+
the form will override submission behavior with
|
257
|
+
``enter_to_submit=False``.
|
258
|
+
|
241
259
|
use_container_width : bool
|
242
260
|
Whether to expand the button's width to fill its parent container.
|
243
261
|
If ``use_container_width`` is ``False`` (default), Streamlit sizes
|