code: def resize(self, dims):
          
          width, height = dims[:2]
          self.dims = (width, height)
          self.logger.debug("renderer reconfigured to %dx%d" % (
              width, height))
  
          # create cairo surface the size of the window
          #surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height)
          depth = len(self.rgb_order)
          self.surface_arr = np.zeros((height, width, depth), dtype=np.uint8)
  
          stride = cairo.ImageSurface.format_stride_for_width(cairo.FORMAT_ARGB32,
                                                              width)
          surface = cairo.ImageSurface.create_for_data(self.surface_arr,
                                                       cairo.FORMAT_ARGB32,
                                                       width, height, stride)
          self.surface = surface
docs: Resize our drawing area to encompass a space defined by the
          given dimensions.