| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
With exists=True and no name, Font now wraps the font description as is, without creating a new named font, so that it is used without loss of precision by actual(), measure() and metrics(). Its name attribute is then the description rather than a string. Keyword options now override the corresponding settings of the given font instead of being ignored. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Documentation build overview66 files changed · ± 65 modified · - 1 deleted ± Modified
- Deleted |
Sorry, something went wrong.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…escription # Conflicts: # Doc/whatsnew/3.16.rst
|
I merge it because I need it for other feature, #72880. |
Sorry, something went wrong.
Drop the assertion in test_create_from_named_font that explicit options override the copied font settings: that behavior was added by pythonGH-152025 and is not in 3.15, where options are ignored when a font is specified. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
| Back | FazBrowse Home | New Git URL |
By default :class:tkinter.font.Font creates a new named font from the given description (via Tcl's font create) and then uses its name in :meth:~tkinter.font.Font.actual, :meth:~tkinter.font.Font.measure and :meth:~tkinter.font.Font.metrics. There is a loss of precision between the description and the created font, so a Font object can behave differently from the equivalent description tuple (gh-143990).
This adds a wrap mode: with exists=True and no name, the font description is wrapped as is, without creating a named font, so that it is used without loss of precision and renders identically to the raw description when used as a widget option. In this case the :attr:!name attribute is the description itself rather than a string (formatted via tkinter._join when used as an option value, the same way ttk formats its style values).
Keeping the description as name (rather than a stringified form) keeps __eq__ correct: a wrapped description never accidentally equals a named font whose name happens to be its string form.
Keyword options now also override the corresponding attributes of the given font instead of being silently ignored.
(There is also an open PR #143992 taking a narrower "preserve negative pixel sizes" approach to the same issue; this is the more general fix.)
🤖 Generated with Claude Code