code: def save_image(self, file_obj):
          
          manager = pyglet.image.get_buffer_manager()
          colorbuffer = manager.get_color_buffer()
  
          # if passed a string save by name
          if hasattr(file_obj, 'write'):
              colorbuffer.save(file=file_obj)
          else:
              colorbuffer.save(filename=file_obj)
docs: Save the current color buffer to a file object
          in PNG format.
  
          Parameters
          -------------
          file_obj: file name, or file- like object