(self)
return srcdc
Retrieve a thread-safe HDC from GetWindowDC().
        In multithreading, if the thread that creates *srcdc* is dead, *srcdc* will
        no longer be valid to grab the screen. The *srcdc* attribute is replaced
        with *_srcdc_dict* to maintain the *srcdc* values in multithreading.
        Since the current thread and main thread are always alive, reuse their *srcdc* value first.
Retrieve a thread-safe HDC from GetWindowDC().
        In multithreading, if the thread that creates *srcdc* is dead, *srcdc* will
        no longer be valid to grab the screen. The *srcdc* attribute is replaced
        with *_srcdc_dict* to maintain the *srcdc* values in multithreading.
        Since the current thread and main thread are always alive, reuse their *srcdc* value first.
Retrieve a thread - safe HDC from GetWindowDC () . In multithreading if the thread that creates * srcdc * is dead * srcdc * will no longer be valid to grab the screen . The * srcdc * attribute is replaced with * _srcdc_dict * to maintain the * srcdc * values in multithreading . Since the current thread and main thread are always alive reuse their * srcdc * value first .
def _get_srcdc(self):
        """
        Retrieve a thread-safe HDC from GetWindowDC().
        In multithreading, if the thread that creates *srcdc* is dead, *srcdc* will
        no longer be valid to grab the screen. The *srcdc* attribute is replaced
        with *_srcdc_dict* to maintain the *srcdc* values in multithreading.
        Since the current thread and main thread are always alive, reuse their *srcdc* value first.
        """
        cur_thread, main_thread = threading.current_thread(), threading.main_thread()
        srcdc = MSS._srcdc_dict.get(cur_thread) or MSS._srcdc_dict.get(main_thread)
        if not srcdc:
            srcdc = MSS._srcdc_dict[cur_thread] = self.user32.GetWindowDC(0)
        return srcdc
def _get_srcdc ( self ) : cur_thread , main_thread = threading . current_thread ( ) , threading . main_thread ( ) srcdc = MSS . _srcdc_dict . get ( cur_thread ) or MSS . _srcdc_dict . get ( main_thread ) if not srcdc : srcdc = MSS . _srcdc_dict [ cur_thread ] = self . user32 . GetWindowDC ( 0 ) return srcdc