liveBook · Manning

St.data_editor

As explained in Build Python Web Apps with Streamlit

st.data_editor is a Streamlit widget that displays editable tabular or collection data and returns the user's edits.

st.data_editor displays tabular or collection data in an editable, spreadsheet-like widget. Pass initial data to it, then use the returned value as the user's current edits. section 9.7.1 section 9.8

Edit game settings

A settings table can let players choose a quizmaster and difficulty. Use num_rows='fixed' when the application needs exactly one settings row: settings = st.data_editor(default_settings, num_rows='fixed', key='settings_editor'). Before interaction, settings matches default_settings; after an edit, it contains the changed dataframe across reruns. section 9.7.1

Configure the editor around the application's constraints:

  • Set num_rows='fixed' to prevent users from adding rows when each setting should have one value. section 9.7.1
  • Give the widget a key so it is represented in session state and protected from a Streamlit widget-state quirk. section 9.7.1

How Build Python Web Apps with Streamlit covers it

How deep it goes
Explains returned edits, fixed rows, widget keys, and column configuration, but stops short of broader editor internals.
Examples
Uses a quiz settings table with Quizmaster and Difficulty columns, selectbox choices, and a final editable game interface.
What it assumes
Assumes familiarity with pandas dataframes and st.dataframe while introducing editable table behavior.
What you can do after
Apply it via Streamlit to collect constrained table edits and pass updated settings into application logic.
How it connects
Connects pandas DataFrame, st.dataframe, st.column_config, st.session_state, and st.popover.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build Python Web Apps with Streamlit. The section links point to the parts of the book it draws on.