original_docstring: 
          Internal method.
          area should be an area of this window that needs to be updated.
          
docstring: Internal method.
  area should be an area of this window that needs to be updated.
docstring_tokens: Internal method . area should be an area of this window that needs to be updated .
code: async def _draw(self, area):
  
          """
          Internal method.
          area should be an area of this window that needs to be updated.
          """
  
          if self.parent:
              area.move_ip(self.pos[0], self.pos[1])
              await self.parent._draw(area)
  
          if self.connectedSurface:
              #render windows to surface
  
              for i in await self._render(area):
  
                  #So, I finally figured out how clipping rectangles work in pygame...
                  #The clipping area is relative to the SOURCE surface, NOT the destination.
                  #So, to do efficient rendering we need to move the clipping area in local space of the source,
                  #then move the resulting clipped image back to global space. We do this by moving the area using the
                  #coordinates of the source, then add the location of the source to the location of the clipping rect
                  #(since we subtracted it before). To make things a bit easier on the eyes I put the respective
                  #calculations on separate lines.
  
                  clippingArea = area.move(-i[1][0], -i[1][1])
                  renderpos = [i[1][0]+clippingArea.left, i[1][1]+clippingArea.top]
  
                  try:
                      self.connectedSurface.blit(i[0], renderpos, clippingArea) #blit surfaces to the connected Surface
                  except pygame.error as e: #This is most likely to happen during shutdown when coroutines try to access the screen
                      self.logger.error("An error occured in the graphics pipeline: "+str(e))
                      return #cancel operation
  
              if DEBUG_LAYOUT:
                  #Shows the drawing boundaries of window updates
                  pygame.draw.rect(self.connectedSurface, (255, 0, 0), area, 1)
  
              if self.connectedSurface == pygame.display.get_surface():
                  #Update screen
                  try:
                      pygame.display.update(area)
                  except: #This can happen if we are using hardware surfaces, for example with OpenGL
                      pass
code_tokens: async def _draw ( self , area ) : if self . parent : area . move_ip ( self . pos [ 0 ] , self . pos [ 1 ] ) await self . parent . _draw ( area ) if self . connectedSurface : for i in await self . _render ( area ) : clippingArea = area . move ( - i [ 1 ] [ 0 ] , - i [ 1 ] [ 1 ] ) renderpos = [ i [ 1 ] [ 0 ] + clippingArea . left , i [ 1 ] [ 1 ] + clippingArea . top ] try : self . connectedSurface . blit ( i [ 0 ] , renderpos , clippingArea ) except pygame . error as e : self . logger . error ( "An error occured in the graphics pipeline: " + str ( e ) ) return if DEBUG_LAYOUT : pygame . draw . rect ( self . connectedSurface , ( 255 , 0 , 0 ) , area , 1 ) if self . connectedSurface == pygame . display . get_surface ( ) : try : pygame . display . update ( area ) except : pass
short_docstring: Internal method.
short_docstring_tokens: Internal method .
comment: """
          Internal method.
          area should be an area of this window that needs to be updated.
          """$SEP$#render windows to surface$SEP$#So, I finally figured out how clipping rectangles work in pygame...$SEP$#The clipping area is relative to the SOURCE surface, NOT the destination.$SEP$#So, to do efficient rendering we need to move the clipping area in local space of the source,$SEP$#then move the resulting clipped image back to global space. We do this by moving the area using the$SEP$#coordinates of the source, then add the location of the source to the location of the clipping rect$SEP$#(since we subtracted it before). To make things a bit easier on the eyes I put the respective$SEP$#calculations on separate lines.$SEP$#blit surfaces to the connected Surface$SEP$#This is most likely to happen during shutdown when coroutines try to access the screen$SEP$#cancel operation$SEP$#Shows the drawing boundaries of window updates$SEP$#Update screen$SEP$#This can happen if we are using hardware surfaces, for example with OpenGL