Reprinted from: http://www.cnblogs.com/fatterbetter/p/4115423.html
Need to use Windows Api,changedisplaysettings
The implementation code is as follows:
1 Import Win32API 2 dm = Win32API. EnumDisplaySettings (None, 0)3 DM. Pelsheight =4 DM. pelswidth = 14005 DM. BitsPerPel =6 DM. Displayfixedoutput = 07 Win32API. ChangeDisplaySettings (DM, 0)
Which, at first did not set the value of the Displayfixedoutput, the effect on my machine is, cut to a small resolution, the screen only in the middle of a small piece, and in the system adjustment, it can be stretched, and later found that this value is in effect
The explanation on MSDN is
Value |
meaning |
|
dmdfo_default |
the display ' s default setting. |
#define Dmdfo_default 0 |
dmdfo_center |
The low-resolution image is centered in the larger screen space. |
#define Dmdfo_center  2 |
dmdfo_stretch |
the low-resolution image is stretched to fill the larger screen space. |
#define Dmdfo_stretch 1 |
Set the value to 1, or 0, to stretch on my machine
With this script, you need to change the resolution, just double-click
"Reprint" Python adjusts the screen resolution