Title: gh-143990: Allow tkinter.font.Font to wrap a font description by serhiy-storchaka · Pull Request #152025 · python/cpython · GitHub
Open Graph Title: gh-143990: Allow tkinter.font.Font to wrap a font description by serhiy-storchaka · Pull Request #152025 · python/cpython
X Title: gh-143990: Allow tkinter.font.Font to wrap a font description by serhiy-storchaka · Pull Request #152025 · python/cpython
Description: 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 Issue: gh-143990
Open Graph Description: 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.Fo...
X Description: 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.fon...
Opengraph URL: https://github.com/python/cpython/pull/152025
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:9794a622-b41c-7bbc-66fb-2000b0beaec2 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 9396:3A03DF:167E5E7:1EDE476:6A53E28A |
| html-safe-nonce | 4ee9516562cab9af9aee4e07e4a5ec00e48c140a11ae711fd32f613b2d399117 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5Mzk2OjNBMDNERjoxNjdFNUU3OjFFREU0NzY6NkE1M0UyOEEiLCJ2aXNpdG9yX2lkIjoiNTk4OTk0ODIyMzg2Mjg1ODM3OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 20ee405c58768c9c142679f4450683861976696d2612408d65d9ecc41852508a |
| hovercard-subject-tag | pull_request:3922477980 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/python/cpython/pull/152025/files |
| twitter:image | https://avatars.githubusercontent.com/u/3659035?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/3659035?s=400&v=4 |
| og:image:alt | 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.Fo... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width