-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
FIX: use wrapped text in Text._get_layout #25346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -367,7 +367,7 @@ def _get_layout(self, renderer): | |||
of a rotated text when necessary. | |||
""" | |||
thisx, thisy = 0.0, 0.0 | |||
lines = self.get_text().split("\n") # Ensures lines is not empty. | |||
lines = self._get_wrapped_text().split("\n") # Ensures lines is not empty. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you understand what the comment is about?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not completely, though I can see that there are a bunch of necessary variables defined in the loop at lines 383-414, which would not exist if lines
was empty. So maybe this is just providing reassurance for that?
@meeseeksdev backport to v3.7.x |
…346-on-v3.7.x Backport PR #25346 on branch v3.7.x (FIX: use wrapped text in Text._get_layout)
PR Summary
Fixes #25336.
Constrained layout here relies on
Text.get_tightbbox
, which callsText.get_window_extent
, which callsText._get_layout
. The example code in the issue now produces:PR Checklist
Documentation and Tests
pytest
passes)Release Notes
.. versionadded::
directive in the docstring and documented indoc/users/next_whats_new/
.. versionchanged::
directive in the docstring and documented indoc/api/next_api_changes/
next_whats_new/README.rst
ornext_api_changes/README.rst