St.button on_click, unexpected key word


hey guys, i saw a keyword of st.button called on_click, however it returns error when i tried to run it.
here is my code
thisYear = st.button(‘This Year’s Overview’,key=None,help=None,on_click=None)
# thisYear.on_click(abc())
nextYear = st.button(‘Next Year’s Forecast’)
big thanks

my streamlit version is 0.85.1

Hi @Qingshuang_Pang,

Welcome to the Streamlit community!! :wave: :partying_face:

Did you upgrade to 0.85.1 using pip (outside of conda)? If so, you should upgrade your Streamlit version within your conda environment, as your streamlit run command is running within it, according to the screenshot.

I suspect the version of Streamlit in the conda environment is older. To confirm, could you please run the following and share a screenshot of your app browser tab?

import streamlit as st

st.write(st.__version__)

thisYear = st.button("This Year’s Overview", key=None, help=None, on_click=None)

Here’s our troubleshooting guide on How to Clean install Streamlit on Windows for reference.

Best, :balloon:
Snehan

Whoops this is so weird


but when i use pip show streamlit, it is 0.85.1
could you kindly help how to upgrade my streamlit?

Do you also see Streamlit, Version 0.82.0 when you run conda list in CMD? If so, you can update Streamlit by running:

conda update streamlit

Let me know if that helps!

Best, :balloon:
Snehan

Yeah, just success! thank you so much! im so confused about these environment things haha … thanks for your big help

2 Likes