Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Draft] Explaining Widget Behavior #643

Closed
wants to merge 7 commits into from

Conversation

MathCatsAnd
Copy link
Contributor

@MathCatsAnd MathCatsAnd commented May 15, 2023

Changed Widget Semantics page to Widget Behavior and elaborated upon the explanations to fully detail the anatomy and logic of how widgets behave in general. #449

This is a first pass. I'm marking it as a draft for feedback. @snehankekre

  • Link redirection for old url
  • Specify (or not) if the page calling the widget is a "construction parameter"

Closes #449

Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

Changed Widget Semantics page to Widget Behavior and elaborated upon the explanations to fully detail the anatomy and logic of how widgets behave in general.
Reworded a few sentences here and there for clarity and grammar.
@MathCatsAnd
Copy link
Contributor Author

MathCatsAnd commented May 16, 2023

I renamed Widget Semantics to Widget Behavior, including in navigation and the menu. I will need to add a redirect from .../widget-semantics to .../widget-behavior to cover any external links but not sure how to do that yet. (Added as checklist item)

Fixed header/subheader capitalization for consistency. Added explanation about widget cleanup within the Life cycle section.
@MathCatsAnd
Copy link
Contributor Author

MathCatsAnd commented May 16, 2023

Preview

@snehankekre snehankekre self-requested a review May 16, 2023 15:03
@MathCatsAnd MathCatsAnd changed the title Explaining Widget Behavior [Draft] Explaining Widget Behavior May 17, 2023
@MathCatsAnd
Copy link
Contributor Author

I have an open issue #streamlit/streamlit#6146 that I also want to clarify. I always understood that specifying a widget exactly the same on two pages visited consecutively would generate a new widget. (i.e. the page calling the widget is in effect one of its defining parameters, just like label, default value, key, etc.) I am questioning my understanding per streamlit/streamlit#6146 (comment)

I want to be sure I explicitly note that. (Added as a checklist item)

Made all references to session state rendered as `st.session_state` to avoid confusion for front end developers about the session state *of the browser* vs the dictionary-like object used in Streamlit.
Edited advance widget behavior article for improved style.
Added an example to describe statefulness of widgets with respect to changing construction parameters (e.g. a slider where min and max values are updated)
@MathCatsAnd MathCatsAnd deleted the widget-behavior branch September 28, 2023 02:38
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Suggest renaming "Advanced notes on widget behavior" page to something more helpful and accurate.
1 participant