def crop(cls, image, area): ''' Return the cropped portion of an image. ''' new_surface = pygame.surface.Surface((area.width, area.height), flags=SRCALPHA) new_surface.blit(image, (0,0), area) return image.subsurface(area).copy()
def __init__(self,image): self.scr = display.get_surface() w,h = image.get_size() w //= 3 self.images = [image.subsurface(x,0,w,h).copy() for x in range(0,w*3,w)] Rect.__init__(self,0,0,w,h) self.ACTIV = True self.status = False self.over = False
def __init__(self, image): self.scr = display.get_surface() w, h = image.get_size() w //= 3 self.images = [ image.subsurface(x, 0, w, h).copy() for x in range(0, w * 3, w) ] Rect.__init__(self, 0, 0, w, h) self.ACTIV = True self.status = False self.over = False