Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
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
4 changes: 0 additions & 4 deletions Lib/idlelib/pyshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
"Your Python may not be configured for Tk. **", file=sys.__stderr__)
raise SystemExit(1)

if sys.platform == 'win32':
from idlelib.util import fix_win_hidpi
fix_win_hidpi()

from tkinter import messagebox

from code import InteractiveInterpreter
Expand Down
15 changes: 0 additions & 15 deletions Lib/idlelib/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,11 @@
* std streams (pyshell, run),
* warning stuff (pyshell, run).
"""
import sys

# .pyw is for Windows; .pyi is for typing stub files.
# The extension order is needed for iomenu open/save dialogs.
py_extensions = ('.py', '.pyw', '.pyi')


# Fix for HiDPI screens on Windows. CALL BEFORE ANY TK OPERATIONS!
# URL for arguments for the ...Awareness call below.
# https://msdn.microsoft.com/en-us/library/windows/desktop/dn280512(v=vs.85).aspx
if sys.platform == 'win32': # pragma: no cover
def fix_win_hidpi(): # Called in pyshell and turtledemo.
try:
import ctypes
PROCESS_SYSTEM_DPI_AWARE = 1 # Int required.
ctypes.OleDLL('shcore').SetProcessDpiAwareness(PROCESS_SYSTEM_DPI_AWARE)
except (ImportError, AttributeError, OSError):
pass


if __name__ == '__main__':
from unittest import main
main('idlelib.idle_test.test_util', verbosity=2)
18 changes: 17 additions & 1 deletion Lib/tkinter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,7 @@ def tk_busy_configure(self, cnf=None, **kw):
tk_busy_hold(). Options may have any of the values accepted by
tk_busy_hold().

Please note that the option database is referenced by the widget
Please note that the option database is11 referenced by the widget
Comment thread
Wulian233 marked this conversation as resolved.
Outdated
name or class. For example, if a Frame widget with name "frame"
is to be made busy, the busy cursor can be specified for it by
either call:
Expand Down Expand Up @@ -2464,6 +2464,22 @@ def __init__(self, screenName=None, baseName=None, className='Tk',
if not sys.flags.ignore_environment:
# Issue #16248: Honor the -E flag to avoid code injection.
self.readprofile(baseName, className)
# Fix for HiDPI screens on Windows
# CALL BEFORE ANY TK OPERATIONS!
# URL for arguments for the ...Awareness call below.
# https://msdn.microsoft.com/en-us/library/windows/desktop/dn280512(v=vs.85).aspx
if sys.platform == 'win32':
import ctypes
try:
# >= win 8.1
PROCESS_SYSTEM_DPI_AWARE: int = 1 # Int required
ctypes.windll.shcore.SetProcessDpiAwareness(PROCESS_SYSTEM_DPI_AWARE)
except (ImportError, AttributeError, OSError):
try:
# win 8.0 or less
ctypes.windll.user32.SetProcessDPIAware()
except (ImportError, AttributeError, OSError):
pass

def loadtk(self):
if not self._tkloaded:
Expand Down
4 changes: 0 additions & 4 deletions Lib/turtledemo/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,6 @@
import turtle
from turtledemo import __doc__ as about_turtledemo

if sys.platform == 'win32':
from idlelib.util import fix_win_hidpi
fix_win_hidpi()

demo_dir = os.path.dirname(os.path.abspath(__file__))
darwin = sys.platform == 'darwin'
STARTUP = 1
Expand Down
1 change: 1 addition & 0 deletions Misc/ACKS
Original file line number Diff line number Diff line change
Expand Up @@ -1097,6 +1097,7 @@ Ivan Levkivskyi
Ben Lewis
William Lewis
Akira Li
Jiahao Li
Robert Li
Xuanji Li
Zekun Li
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix HiDPI blurring of every program window that using tkinter. Patch by
Wulian233