Commit d274afb5 authored by Terry Jan Reedy's avatar Terry Jan Reedy Committed by GitHub

bpo-33656: Move pyshell ctypes import inside try block. (GH-9858)

A Windows build with _tkinter, tkinter, and idlelib
but without ctypes is unlikely but apparently possible.
parent 97cf0828
...@@ -12,11 +12,11 @@ except ImportError: ...@@ -12,11 +12,11 @@ except ImportError:
# Valid arguments for the ...Awareness call below are defined in the following. # Valid arguments for the ...Awareness call below are defined in the following.
# https://msdn.microsoft.com/en-us/library/windows/desktop/dn280512(v=vs.85).aspx # https://msdn.microsoft.com/en-us/library/windows/desktop/dn280512(v=vs.85).aspx
if sys.platform == 'win32': if sys.platform == 'win32':
try:
import ctypes import ctypes
PROCESS_SYSTEM_DPI_AWARE = 1 PROCESS_SYSTEM_DPI_AWARE = 1
try:
ctypes.OleDLL('shcore').SetProcessDpiAwareness(PROCESS_SYSTEM_DPI_AWARE) ctypes.OleDLL('shcore').SetProcessDpiAwareness(PROCESS_SYSTEM_DPI_AWARE)
except (AttributeError, OSError): except (ImportError, AttributeError, OSError):
pass pass
import tkinter.messagebox as tkMessageBox import tkinter.messagebox as tkMessageBox
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment