Visitar URL original
gh-119174: Fix high DPI causes turtledemo(turtle-graphics examples) windows blurry by Wulian233 · Pull Request #119175 · python/cpython · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix high DPI causes turtledemo(turtle-graphics examples) windows blurry
  • Loading branch information
Wulian233 committed May 19, 2024
commit b68e2bce1fe4b02a5418054e0ea5be36d9fb0b3d
2 changes: 1 addition & 1 deletion Lib/idlelib/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def __init__(self, _utest=False):
self.userCfg = {}
self.cfg = {} # TODO use to select userCfg vs defaultCfg
# self.blink_off_time = <first editor text>['insertofftime']
# See https:/bugs.python.org/issue4630, msg356516.
# See https://bugs.python.org/issue4630#msg356516

if not _utest:
self.CreateConfigHandlers()
Expand Down
11 changes: 11 additions & 0 deletions Lib/turtledemo/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,10 @@

import turtle


Comment thread
Wulian233 marked this conversation as resolved.
demo_dir = os.path.dirname(os.path.abspath(__file__))
darwin = sys.platform == 'darwin'
win32 = sys.platform == 'win32'

STARTUP = 1
READY = 2
Expand Down Expand Up @@ -131,6 +133,15 @@ def __init__(self, filename=None):
root.title('Python turtle-graphics examples')
root.wm_protocol("WM_DELETE_WINDOW", self._destroy)

# See https://learn.microsoft.com/en-us/windows/win32/api/shellscalingapi/ne-shellscalingapi-process_dpi_awareness
if win32:
try:
import ctypes
PROCESS_SYSTEM_DPI_AWARE = 1 # Int required.
ctypes.OleDLL('shcore').SetProcessDpiAwareness(PROCESS_SYSTEM_DPI_AWARE)
except (ImportError, AttributeError, OSError):
pass

if darwin:
import subprocess
# Make sure we are the currently activated OS X application
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix high DPI causes turtledemo(turtle-graphics examples) windows blurry
Patch by Wulian233
Comment thread
terryjreedy marked this conversation as resolved.
Outdated