Title: gh-143990: Preserve negative pixel sizes in tkinter.font.Font by dawdameet · Pull Request #143992 · python/cpython · GitHub
Open Graph Title: gh-143990: Preserve negative pixel sizes in tkinter.font.Font by dawdameet · Pull Request #143992 · python/cpython
X Title: gh-143990: Preserve negative pixel sizes in tkinter.font.Font by dawdameet · Pull Request #143992 · python/cpython
Description: gh-143990: Preserve negative pixel sizes in tkinter.font.Font Summary This PR fixes a bug where tkinter.font.Font objects would lose their negative sign (representing pixel size) and convert it to a positive integer (representing points) during initialization. details The Font.init method calls tk.call("font", "actual", font). In Tcl/Tk, font actual resolves the requested font to the system's closest match. If a font is requested in pixels (e.g., -14), Tcl calculates the equivalent point size (e.g., 11) based on the current DPI. The current implementation in tkinter/font.py was blindly accepting this resolved value and overwriting the user's original request. This fix checks if the input was a tuple containing a size, and if so, restores that specific size after the font actual call. Changes Modified Lib/tkinter/font.py to preserve the user-requested size. Added a regression test test_negative_pixel_size to Lib/test/test_tkinter/test_font.py. Verified that Font.cget("size") now returns the correct negative integer.
Open Graph Description: gh-143990: Preserve negative pixel sizes in tkinter.font.Font Summary This PR fixes a bug where tkinter.font.Font objects would lose their negative sign (representing pixel size) and convert it to ...
X Description: gh-143990: Preserve negative pixel sizes in tkinter.font.Font Summary This PR fixes a bug where tkinter.font.Font objects would lose their negative sign (representing pixel size) and convert it to ...
Opengraph URL: https://github.com/python/cpython/pull/143992
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:deaf0af9-8cf6-1c58-b70a-89fc53c90ada |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 80A6:2049AA:1C01A4B:25E120B:6A536AA2 |
| html-safe-nonce | d41b84371770906edb0c27d12c5118b1bac09120dab1ada9daab3e46660ddd4f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MEE2OjIwNDlBQToxQzAxQTRCOjI1RTEyMEI6NkE1MzZBQTIiLCJ2aXNpdG9yX2lkIjoiMjM5OTM5MDA0MDEwOTMxMjY3NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 99c84108cb48a1df404c040d0edec4022058b5beaff16bc1bcd2fe2684e65d17 |
| hovercard-subject-tag | pull_request:3185162257 |
| 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/143992/files |
| twitter:image | https://avatars.githubusercontent.com/u/94282163?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/94282163?s=400&v=4 |
| og:image:alt | gh-143990: Preserve negative pixel sizes in tkinter.font.Font Summary This PR fixes a bug where tkinter.font.Font objects would lose their negative sign (representing pixel size) and convert it to ... |
| 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 | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width