我是新手。我尝试使用 mss 来截屏监视器。我的代码:
for i in range(1, 20000):
cactus_box = {'left': 508, 'top': 382, 'width': 30, 'height': 33}
sct = mss()
sct_img = sct.grab(cactus_box)
当我运行代码时,此显示错误:
File "C:\Users\xxxx\AppData\Local\Programs\Python\Python36-32\lib\site-packages\mss\windows.py", line 203, in grab
raise ScreenShotError('gdi32.GetDIBits() failed.', locals())
mss.exception.ScreenShotError: ('gdi32.GetDIBits() failed.', {'bits': 0, 'height': 33, 'width': 30, 'gdi': <WinDLL 'gdi32', handle 75f00000 at 0x93dd5f0>, 'monitor': {'left': 508, 'top': 382, 'width': 30, 'height': 33}, 'self': <mss.windows.MSS object at 0x093DD810>})
拜托,有人可以告诉我解决这个错误