class_docstr: ScreenGear is designed exclusively for targeting rapid Screencasting Capabilities, which means it can
  grab frames from your monitor in real-time, either by defining an area on the computer screen or full-screen,
  at the expense of inconsiderable latency. ScreenGear also seamlessly support frame capturing from multiple
  monitors as well as supports multiple backends.
  
  ScreenGear API implements a multi-threaded wrapper around dxcam, pyscreenshot, python-mss python library,
  and also flexibly supports its internal parameter.
docstr: A **Threaded Frames Extractor**, that keep iterating frames from `mss` API to a internal monitored deque,
  until the thread is terminated, or frames runs out.
docstr_tok: ["A","*","*","Threaded","Frames","Extractor","*","*",",","that","keep","iterating","frames","from","`","mss","`","API","to","a","internal","monitored","deque",",","until","the","thread","is","terminated",",","or","frames","runs","out","."]
code: def __update(self):
      """
      A **Threaded Frames Extractor**, that keep iterating frames from `mss` API to a internal monitored deque,
      until the thread is terminated, or frames runs out.
      """
      # initialize frame variable
      frame = None
      # keep looping infinitely until the thread is terminated
      while not self.__terminate.is_set():
          try:
              if self.__backend == "dxcam":
                  # extract global frame from instance
                  frame = self.__capture_object.get_latest_frame()
              else:
                  if self.__monitor_instance:
                      frame = np.asanyarray(
                          self.__capture_object.grab(
                              self.__mss_capture_instance
                          )
                      )
                  else:
                      frame = np.asanyarray(
                          self.__capture_object.grab(
                              bbox=self.__mss_capture_instance,
                              childprocess=False,
                              backend=self.__backend,
                          )
                      )
              # check if valid frame
              assert not (
                  frame is None or np.shape(frame) == ()
              ), "[ScreenGear:ERROR] :: Failed to retrieve valid frame!"
              # convert to bgr frame if applicable
              frame = (
                  frame[:, :, ::-1]
                  if self.__backend == "dxcam" or not (pysct is None)
                  else frame
              )
          except Exception as e:
              if isinstance(e, ScreenShotError):
                  raise RuntimeError(
                      self.__capture_object.get_error_details()
                  )
              else:
                  logger.exception(str(e))
              self.__terminate.set()
              continue
  
          if not (self.color_space is None):
              # apply colorspace to frames
              color_frame = None
              try:
                  if isinstance(self.color_space, int):
                      color_frame = cv2.cvtColor(
                          frame, self.color_space
                      )
                  else:
                      self.__logging and logger.warning(
                          "Global color_space parameter value `{}` is not a valid!".format(
                              self.color_space
                          )
                      )
                      self.color_space = None
              except Exception as e:
                  # Catch if any error occurred
                  self.color_space = None
                  if self.__logging:
                      logger.exception(str(e))
                      logger.warning(
                          "Input colorspace is not a valid colorspace!"
                      )
              if not (color_frame is None):
                  self.frame = color_frame
              else:
                  self.frame = frame
          else:
              self.frame = frame
  
      # indicate immediate termination
      self.__terminate.set()
  
      # finally release mss resources
      if self.__monitor_instance:
          self.__capture_object.close()
      if self.__backend == "dxcam":
          self.__capture_object.stop()
          del self.__capture_object
  
file_path: vidgear/vidgear/gears/screengear.py
imports: import cv2
  import json
  import platform
  import numpy
  import logging
  from threading import Thread, Event
  from collections import OrderedDict
  from .helper import import_dependency_safe, capPropId, logger_handler, logcurr_vidgear_ver
label_desc: Use image node_id 3 for calling the ScreenGear obj's underlying member method code with example usage: obj.__update() without return types