函数签名
st.date_input(label, value=None, min_value=None, max_value=None, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False)
参数 | 说明 |
---|---|
label (str) | 一个简短的标签,向用户解释此日期输入的用途。 |
value (datetime.date or datetime.datetime or list/tuple of datetime.date or datetime.datetime or None) | 此小部件首次呈现时的值。如果提供了具有 0 到 2 个日期/日期时间值的列表/元组,则日期选择器将允许用户提供范围。默认为今天作为单一日期选择器。 |
min_value (datetime.date or datetime.datetime) | 最小可选日期。如果 value 是日期,则默认为 value - 10 年。如果 value 是间隔 [start, end],默认为 start - 10 年。 |
max_value (datetime.date or datetime.datetime) | 最大可选择日期。如果 value 是日期,则默认为 value + 10 年。如果 value 是间隔 [start, end],默认为 end + 10 年。 |
key (str or int) | 一个可选的字符串或整数,用作小部件的唯一键。如果省略,将根据其内容为小部件生成一个 key 。相同类型的多个小部件可能不共享相同的键。 |
help (str) | 显示在输入旁边的可选工具提示。 |
on_change (callable) | 当此 date_input 的值更改时调用的可选回调。 |
args (tuple) | 传递给回调的可选参数元组。 |
kwargs (dict) | 一个可选的 kwargs 字典传递给回调。 |
disabled (bool) | 一个可选的布尔值,如果设置为 True,则禁用日期输入。默认值为假。此参数只能由关键字提供。 |
返回 | 说明 |
(datetime.date or a tuple with 0-2 dates) | 日期输入小部件的当前值。 |
示例
d = st.date_input(
"When's your birthday",
datetime.date(2019, 7, 6))
st.write('Your birthday is:', d)
相关用法
- Python Streamlit st.dataframe用法及代码示例
- Python Streamlit st.download_button用法及代码示例
- Python Streamlit st.experimental_singleton.clear用法及代码示例
- Python Streamlit st.bokeh_chart用法及代码示例
- Python Streamlit st.caption用法及代码示例
- Python Streamlit st.text_input用法及代码示例
- Python Streamlit st.area_chart用法及代码示例
- Python Streamlit st.title用法及代码示例
- Python Streamlit st.cache用法及代码示例
- Python Streamlit st.experimental_singleton用法及代码示例
- Python Streamlit st.empty用法及代码示例
- Python Streamlit st.error用法及代码示例
- Python Streamlit st.video用法及代码示例
- Python Streamlit st.vega_lite_chart用法及代码示例
- Python Streamlit st.slider用法及代码示例
- Python Streamlit st.header用法及代码示例
- Python Streamlit st.container用法及代码示例
- Python Streamlit st.form_submit_button用法及代码示例
- Python Streamlit st.form用法及代码示例
- Python Streamlit st.plotly_chart用法及代码示例
- Python Streamlit st.bar_chart用法及代码示例
- Python Streamlit st.code用法及代码示例
- Python Streamlit st.experimental_memo.clear用法及代码示例
- Python Streamlit st.warning用法及代码示例
- Python Streamlit st.image用法及代码示例
注:本文由纯净天空筛选整理自streamlit.io大神的英文原创作品 st.date_input。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。