while trying to reproduce codes on PoE AI Part 4: Real-time Screen Capture and Plumbing, i encountered an error like this :
PS E:\tmp\game_assistant> python .\SSTime.py
Exception in thread Thread-1:
Traceback (most recent call last):
File “D:\Program Files\Anaconda3\lib\threading.py”, line 914, in _bootstrap_inner
self.run()
File “D:\Program Files\Anaconda3\lib\threading.py”, line 862, in run
self._target(*self._args, **self._kwargs)
File “E:\tmp\game_assistant\ScreenViewer.py”, line 114, in ScreenUpdateT
self.i1 = self.GetScreenImg()
File “E:\tmp\game_assistant\ScreenViewer.py”, line 69, in GetScreenImg
dataBitMap.CreateCompatibleBitmap(dcObj, w, h)
win32ui.error: CreateCompatibleDC failed
it is due to minimizing window, that is to say:
TLDR
TLDR
TLDR
you should unminimizing the required window, then the codes will run sucessfully.
TLDR
TLDR
TLDR
PS:
elasped time using two screen capture methods on my own pc:
direct method : 0.03 ~ 0.05 s
author’s method : 0.006 ~0.011 s