def _get_screen_buffer(self, bounds=None):
    # Grabs a DC to the entire virtual screen, but only copies to
    # the bitmap the the rect defined by the user.

    SM_XVIRTUALSCREEN = 76  # coordinates for the left side of the virtual screen.
    SM_YVIRTUALSCREEN = 77  # coordinates for the right side of the virtual screen.
    SM_CXVIRTUALSCREEN = 78 # width of the virtual screen
    SM_CYVIRTUALSCREEN = 79 # height of the virtual screen

    hDesktopWnd = user32.GetDesktopWindow() #Entire virtual Screen

    left = user32.GetSystemMetrics(SM_XVIRTUALSCREEN)
    top = user32.GetSystemMetrics(SM_YVIRTUALSCREEN)
    width = user32.GetSystemMetrics(SM_CXVIRTUALSCREEN)
    height = user32.GetSystemMetrics(SM_CYVIRTUALSCREEN)

    if bounds:
      left, top, right, bottom = bounds
      width = right - left
      height = top - bottom

    hDesktopDC = user32.GetWindowDC(hDesktopWnd)
    if not hDesktopDC: print('GetDC Failed'); sys.exit()

    hCaptureDC = gdi.CreateCompatibleDC(hDesktopDC)
    if not hCaptureDC: print('CreateCompatibleBitmap Failed'); sys.exit()

    hCaptureBitmap = gdi.CreateCompatibleBitmap(hDesktopDC, width, height)
    if not hCaptureBitmap: print('CreateCompatibleBitmap Failed'); sys.exit()

    gdi.SelectObject(hCaptureDC, hCaptureBitmap)

    SRCCOPY = 0x00CC0020
    gdi.BitBlt(
      hCaptureDC,
      0, 0,
      width, height,
      hDesktopDC,
      left, top,
      0x00CC0020
    )
    return hCaptureBitmap
dataset/ETHPy150Open chriskiehl/pyrobot/pyrobot.py/Robot._get_screen_buffer/swapped operands of `-`