docs: Document PackMixin and Pack style shorthand on Widget#4356
Open
arijiiiitttt wants to merge 3 commits into
Open
Conversation
freakboy3742
requested changes
Apr 29, 2026
Member
freakboy3742
left a comment
There was a problem hiding this comment.
Thanks for the PR - however, what you've documented here conflicts with the specific advice that I gave in my comment on the original ticket: that ideally, PackMixin wouldn't be documented or surfaced at all. Instead, you've specifically documented PackMixin and included full documentation of the mixin.
We do need to document the relationship between styles, `*kwargs, and style-related properties on widgets - but we need to do that without referencing PackMixin.
Comment on lines
78
to
+79
| :param style: A style object. If no style is provided, a default style | ||
| will be applied to the widget. | ||
| will be applied to the widget. |
Member
There was a problem hiding this comment.
The indentation here is required.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4353
What changed
core/src/toga/widgets/base.pyWidget.__init__docstring explaining that becauseWidgetinherits fromPackMixin, Pack style properties can be set directly on any widget instance (e.g.widget.flex = 1instead ofwidget.style.flex = 1).docs/reference/api/widgets/widget.mdPackMixinto the reference section so it appears in the generated documentation with its docstring and property list.Why
Users had no way of knowing that Pack style properties could be set directly on a widget.
PackMixinappeared in the base classes ofWidgetbut was not documented or linked anywhere, making it very hard to discover this feature.PR Checklist: