Title: In linux, copying a tkinter font doubles its size when using Tk 8.6 and a hi-res screen. · Issue #128719 · python/cpython · GitHub
Open Graph Title: In linux, copying a tkinter font doubles its size when using Tk 8.6 and a hi-res screen. · Issue #128719 · python/cpython
X Title: In linux, copying a tkinter font doubles its size when using Tk 8.6 and a hi-res screen. · Issue #128719 · python/cpython
Description: Bug report Bug description: >>> import tkinter >>> from tkinter.font import Font >>> root = tkinter.Tk() >>> f1 = Font(name='TkDefaultFont', exists=True) >>> f1.actual() {'family': 'Noto Sans', 'size': 20, 'weight': 'normal', 'slant': 'r...
Open Graph Description: Bug report Bug description: >>> import tkinter >>> from tkinter.font import Font >>> root = tkinter.Tk() >>> f1 = Font(name='TkDefaultFont', exists=True) >>> f1.actual() {'family': 'Noto Sans', 'si...
X Description: Bug report Bug description: >>> import tkinter >>> from tkinter.font import Font >>> root = tkinter.Tk() >>> f1 = Font(name='TkDefaultFont', exists=True)...
Opengraph URL: https://github.com/python/cpython/issues/128719
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"In linux, copying a tkinter font doubles its size when using Tk 8.6 and a hi-res screen.","articleBody":"# Bug report\n\n### Bug description:\n\n```python\n\u003e\u003e\u003e import tkinter\n\u003e\u003e\u003e from tkinter.font import Font\n\u003e\u003e\u003e root = tkinter.Tk()\n\u003e\u003e\u003e f1 = Font(name='TkDefaultFont', exists=True)\n\u003e\u003e\u003e f1.actual()\n{'family': 'Noto Sans', 'size': 20, 'weight': 'normal', 'slant': 'roman', 'underline': 0, 'overstrike': 0}\n\u003e\u003e\u003e f2 = f1.copy()\n\u003e\u003e\u003e f2.actual()\n{'family': 'Noto Sans', 'size': 40, 'weight': 'normal', 'slant': 'roman', 'underline': 0, 'overstrike': 0}\n\u003e\u003e\u003e f3 = f2.copy()\n\u003e\u003e\u003e f3.actual()\n{'family': 'Noto Sans', 'size': 80, 'weight': 'normal', 'slant': 'roman', 'underline': 0, 'overstrike': 0}\n\u003e\u003e\u003e f4 = f3.copy()\n\u003e\u003e\u003e f4.actual()\n{'family': 'Noto Sans', 'size': 160, 'weight': 'normal', 'slant': 'roman', 'underline': 0, 'overstrike': 0}\n```\nThe example above is from Ubuntu 24.04 running on an Asus Zenbook with EVO screen. The display scaling from the system settings is the default, namely 200%. This does not happen when the display scaling is 100%.\n\nNote that font f1 is already (more than) doubled in size, compared to what wish8.6 (built from 8.6.15 source) reports:\n```\n% info patchlevel\n8.6.15\n% font actual TkDefaultFont\n-family {Noto Sans} -size 9 -weight normal -slant roman -underline 0 -overstrike 0\n% font config TkDefaultFont\n-family sans-serif -size -12 -weight normal -slant roman -underline 0 -overstrike 0\n```\nThe negative value -12 means that the size is 12 pixels, as opposed to 12 points. I think the intitial expansion being slightly more than a factor of 2 may be caused by rounding when converting pixels to points.\n\nNote that the behavior of Tk 9 is different. Using wish9.0 on the same system produces:\n```\n% info patchlevel\n9.0.0\n% font actual TkDefaultFont\n-family {Noto Sans} -size 10 -weight normal -slant roman -underline 0 -overstrike 0\n% font config TkDefaultFont\n-family sans-serif -size 10 -weight normal -slant roman -underline 0 -overstrike 0\n```\nAlso, the pending new version of tkinter from #124156 does not have this doubling behavior when used with Tk 9.0. (I have not tested the new tkinter with Tk 8.6, but I expect it to have the broken behavior since I don't think that the PR changes Font.copy.)\n\n\n### CPython versions tested on:\n\n3.12\n\n### Operating systems tested on:\n\nLinux","author":{"url":"https://github.com/culler","@type":"Person","name":"culler"},"datePublished":"2025-01-10T23:04:29.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/128719/cpython/issues/128719"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:3d4545b2-f63b-4f43-d254-983e9ecddac4 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E602:3B458B:1E4585:27F774:696B628C |
| html-safe-nonce | 5978934c0c0d2ee7d177efa333506276c8f0291b5a7140d04bed0b1f0a97d936 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNjAyOjNCNDU4QjoxRTQ1ODU6MjdGNzc0OjY5NkI2MjhDIiwidmlzaXRvcl9pZCI6IjYwOTU4ODEwMjM4MTMwMTgyNTIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 70181b7ae8ce760a89208818a6d1f331d6eae4958ec3dd576f3b0f8cf70a8cb7 |
| hovercard-subject-tag | issue:2781372741 |
| github-keyboard-shortcuts | repository,issues,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/_view_fragments/issues/show/python/cpython/128719/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7dcfb4d417cfe5b6b90a07f810946332970d10acb7b653dfd4d10d54b090924f/python/cpython/issues/128719 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7dcfb4d417cfe5b6b90a07f810946332970d10acb7b653dfd4d10d54b090924f/python/cpython/issues/128719 |
| og:image:alt | Bug report Bug description: >>> import tkinter >>> from tkinter.font import Font >>> root = tkinter.Tk() >>> f1 = Font(name='TkDefaultFont', exists=True) >>> f1.actual() {'family': 'Noto Sans', 'si... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | culler |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d |
| turbo-cache-control | no-preview |
| 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 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 82560a55c6b2054555076f46e683151ee28a19bc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width