test_theme.py 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import streamlit as st
  2. st.write("Normal efg")
  3. st.write("*Italic efg*")
  4. st.write("**Bold efg**")
  5. st.write("***Bold-italic efg***")
  6. st.write("`Code normal efg`")
  7. st.write("*`Code italic efg`*")
  8. st.write("**`Code bold efg`**")
  9. st.write("***`Code bold-italic efg`***")
  10. st.subheader('Counter Example using Callbacks with args')
  11. if 'count' not in st.session_state:
  12. st.session_state.count = 0
  13. increment_value = st.number_input('Enter a value', value=0, step=1)
  14. def increment_counter(increment_value):
  15. st.session_state.count += increment_value
  16. increment = st.button('Increment', on_click=increment_counter,
  17. args=(increment_value, ))
  18. st.write('Count = ', st.session_state.count)
  19. if "celsius" not in st.session_state:
  20. # set the initial default value of the slider widget
  21. st.session_state.celsius = 50.0
  22. st.slider(
  23. "Temperature in Celsius",
  24. min_value=-100.0,
  25. max_value=100.0,
  26. key="celsius"
  27. )
  28. # This will get the value of the slider widget
  29. st.write(st.session_state.celsius)
  30. if 'my_button' not in st.session_state:
  31. st.session_state.my_button = True
  32. # Streamlit will raise an Exception on trying to set the state of button
  33. st.button('Submit', key='my_button')