'setIn' cannot be called on an ElementNode when using experimental_dialog

Code to reproduce.

import streamlit as st
def onclick(txt):
    st.toast(txt)

if st.button("1. normal toast"):
    onclick("this is okay")

st.button("2. another toast", on_click=lambda: onclick("also ok"))

@st.experimental_dialog("New dialog")
def open_dialog():
    if st.button("3. this should work?"):
        onclick("okay!")
    st.button("4. this does not work",
          on_click = lambda: onclick("this does not work"))

if st.button("open dialog"):
    open_dialog()

App is run locally.
Python version: 3.11.9
Streamlit version: 1.35.0

More info:
Button 4 does not work
No errors are thrown in command line.
The dialog disappears, and is replaced by this below:

Current workaround is using button 3.
However, the toast appears behind the dialog, instead of in front of the dialog.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.