File tree 5 files changed +26
-11
lines changed
Filter options
5 files changed +26
-11
lines changed
Original file line number Diff line number Diff line change @@ -158,8 +158,9 @@ def __init__(self, _utest=False):
158
158
self .defaultCfg = {}
159
159
self .userCfg = {}
160
160
self .cfg = {} # TODO use to select userCfg vs defaultCfg
161
+
162
+ # See https://bugs.python.org/issue4630#msg356516 for following.
161
163
# self.blink_off_time = <first editor text>['insertofftime']
162
- # See https://bugs.python.org/issue4630#msg356516.
163
164
164
165
if not _utest :
165
166
self .CreateConfigHandlers ()
Original file line number Diff line number Diff line change 11
11
"Your Python may not be configured for Tk. **" , file = sys .__stderr__ )
12
12
raise SystemExit (1 )
13
13
14
- # Valid arguments for the ...Awareness call below are defined in the following.
15
- # https://msdn.microsoft.com/en-us/library/windows/desktop/dn280512(v=vs.85).aspx
16
14
if sys .platform == 'win32' :
17
- try :
18
- import ctypes
19
- PROCESS_SYSTEM_DPI_AWARE = 1 # Int required.
20
- ctypes .OleDLL ('shcore' ).SetProcessDpiAwareness (PROCESS_SYSTEM_DPI_AWARE )
21
- except (ImportError , AttributeError , OSError ):
22
- pass
15
+ from idlelib .util import fix_win_hidpi
16
+ fix_win_hidpi ()
23
17
24
18
from tkinter import messagebox
25
19
Original file line number Diff line number Diff line change 12
12
* std streams (pyshell, run),
13
13
* warning stuff (pyshell, run).
14
14
"""
15
+ import sys
15
16
16
17
# .pyw is for Windows; .pyi is for typing stub files.
17
18
# The extension order is needed for iomenu open/save dialogs.
18
19
py_extensions = ('.py' , '.pyw' , '.pyi' )
19
20
21
+
22
+ # Fix for HiDPI screens on Windows. CALL BEFORE ANY TK OPERATIONS!
23
+ # URL for arguments for the ...Awareness call below.
24
+ # https://msdn.microsoft.com/en-us/library/windows/desktop/dn280512(v=vs.85).aspx
25
+ if sys .platform == 'win32' : # pragma: no cover
26
+ def fix_win_hidpi (): # Called in pyshell and turtledemo.
27
+ try :
28
+ import ctypes
29
+ PROCESS_SYSTEM_DPI_AWARE = 1 # Int required.
30
+ ctypes .OleDLL ('shcore' ).SetProcessDpiAwareness (PROCESS_SYSTEM_DPI_AWARE )
31
+ except (ImportError , AttributeError , OSError ):
32
+ pass
33
+
34
+
20
35
if __name__ == '__main__' :
21
36
from unittest import main
22
37
main ('idlelib.idle_test.test_util' , verbosity = 2 )
Original file line number Diff line number Diff line change 92
92
from idlelib .colorizer import ColorDelegator , color_config
93
93
from idlelib .percolator import Percolator
94
94
from idlelib .textview import view_text
95
+ import turtle
95
96
from turtledemo import __doc__ as about_turtledemo
96
97
97
- import turtle
98
+ if sys .platform == 'win32' :
99
+ from idlelib .util import fix_win_hidpi
100
+ fix_win_hidpi ()
98
101
99
102
demo_dir = os .path .dirname (os .path .abspath (__file__ ))
100
103
darwin = sys .platform == 'darwin'
101
-
102
104
STARTUP = 1
103
105
READY = 2
104
106
RUNNING = 3
Original file line number Diff line number Diff line change
1
+ Fix high DPI causes turtledemo(turtle-graphics examples) windows blurry
2
+ Patch by Wulian233 and Terry Jan Reedy
3
+
You can’t perform that action at this time.
0 commit comments