问题
i have a big problem with windows 10, normaly i used PIL (Python) to get a nice and clean screenshot from inside a program.
but with windows 10 this does not work anymore, now i become only everything on the Desktop but my FullScreen Window is missing.
i also tryed to use:
BitBlt(screen_copy, 0, 0, width, height, screen, left, top, SRCCOPY | CAPTUREBLT)
but the result is exactly the same :(
does anybody has any solution or idea what has changed in Win10?
thank you so much.
回答1:
Another approach that is really fast is the MSS module. It uses only the ctypes
standard module, so it does not require any dependencies. It is OS independant, works with Windows 10 and its use is made easy:
from mss import mss
with mss() as sct:
sct.shot()
And just find the screenshot.png
file containing the screen shot of the first monitor. There are a lot of possibile customizations, you can play with ScreenShot
objects and OpenCV/Numpy/PIL/etc..
来源:https://stackoverflow.com/questions/44774169/screenshot-pilimagegrab-grab-bitblt-on-win10-only-return-the-background