Update slider value

Hi @jorick!

  1. How can I modify the value of the slider widget?

I’m having trouble understanding what exactly you’re trying to build. Can you post a mockup?

Answering your question as best I can without the mockup, I think what you’re looking for is support for “session state”. We have a session state feature request here, and a prototype implementation here.

This is how your code would look with the prototype implementation:

import streamlit as st

# SessionState module from https://gist.github.com/tvst/036da038ab3e999a64497f42de966a92
import SessionState

state = SessionState.get(position=0)

# The slider needs to come after the button, to make sure the first increment
# works correctly. So we create a placeholder for it here first, and fill it in
# later.
widget = st.empty()

if st.button('Increment position'):
    state.position += 1

state.position = widget.slider('Position', 0, 100, state.position)
  1. How can I clear the button push after it has been pushed?

Buttons get cleared automatically next time the script runs. So if you have x = st.button("Click me!"), then:

  1. The first time your app runs, x is False.
  2. When you interact with any other widget in your app, x is False
  3. When you click the button, x is True.
  4. Next time you interact with any other widget in your app, x is False again