| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- import streamlit as st
- st.write("Normal efg")
- st.write("*Italic efg*")
- st.write("**Bold efg**")
- st.write("***Bold-italic efg***")
- st.write("`Code normal efg`")
- st.write("*`Code italic efg`*")
- st.write("**`Code bold efg`**")
- st.write("***`Code bold-italic efg`***")
- st.subheader('Counter Example using Callbacks with args')
- if 'count' not in st.session_state:
- st.session_state.count = 0
- increment_value = st.number_input('Enter a value', value=0, step=1)
- def increment_counter(increment_value):
- st.session_state.count += increment_value
- increment = st.button('Increment', on_click=increment_counter,
- args=(increment_value, ))
- st.write('Count = ', st.session_state.count)
- if "celsius" not in st.session_state:
- # set the initial default value of the slider widget
- st.session_state.celsius = 50.0
- st.slider(
- "Temperature in Celsius",
- min_value=-100.0,
- max_value=100.0,
- key="celsius"
- )
- # This will get the value of the slider widget
- st.write(st.session_state.celsius)
- if 'my_button' not in st.session_state:
- st.session_state.my_button = True
- # Streamlit will raise an Exception on trying to set the state of button
- st.button('Submit', key='my_button')
|