The new feature write_stream() in streamlit 1.31.0 works well with my app. The text output from a chess engine is correctly streamed in the ui. I wrap the write_stream() in a container() and set container’s height to 200. Since the output is long and with a given height, a veritcal scrollbar is shown. This scrollbar goes up as more data are streamed. I would like to request a feature to add an option in the container for the scrollbar to go to the bottom because the engine’s latest output including the bestmove are at the bottom.
Sample code
# The FEN string for the chessboard position
fen = st.text_input('Enter FEN')
asec = st.number_input('Analysis time in sec.', value=1.0, step=0.1)
enginefn = st.text_input('Input engine file')
if fen and enginefn:
board = chess.Board(fen)
board_svg = chess.svg.board(board=board, size=300)
st.image(board_svg)
if st.button('Analyze position'):
with st.container(border=True, height=200):
st.write_stream(run_engine(enginefn, fen, asec))