parameters: (hwnd, rect=None)
return_statement: return PIL.ImageGrab.grab(rect)
docstring: Scrape a visible window and return its contents as a bitmap.
  
    Args:
      hwnd: handle of the window to scrape
      rect: rectangle to scrape in client coords, defaults to the whole thing
            If specified, it's a 4-tuple of (left, top, right, bottom)
  
    Returns:
      An Image containing the scraped data
docstring_summary: Scrape a visible window and return its contents as a bitmap.
docstring_tokens: Scrape a visible window and return its contents as a bitmap .
function: def ScrapeWindow(hwnd, rect=None):
    """Scrape a visible window and return its contents as a bitmap.
  
    Args:
      hwnd: handle of the window to scrape
      rect: rectangle to scrape in client coords, defaults to the whole thing
            If specified, it's a 4-tuple of (left, top, right, bottom)
  
    Returns:
      An Image containing the scraped data
    """
    # Activate the window
    SetForegroundWindow(hwnd)
  
    # If no rectangle was specified, use the fill client rectangle
    if not rect: rect = win32gui.GetClientRect(hwnd)
  
    upper_left  = win32gui.ClientToScreen(hwnd, (rect[0], rect[1]))
    lower_right = win32gui.ClientToScreen(hwnd, (rect[2], rect[3]))
    rect = upper_left+lower_right
  
    return PIL.ImageGrab.grab(rect)
function_tokens: def ScrapeWindow ( hwnd , rect = None ) : # Activate the window SetForegroundWindow ( hwnd ) # If no rectangle was specified, use the fill client rectangle if not rect : rect = win32gui . GetClientRect ( hwnd ) upper_left = win32gui . ClientToScreen ( hwnd , ( rect [ 0 ] , rect [ 1 ] ) ) lower_right = win32gui . ClientToScreen ( hwnd , ( rect [ 2 ] , rect [ 3 ] ) ) rect = upper_left + lower_right return PIL . ImageGrab . grab ( rect )