def get(self, image): if isinstance(image, Texture): return image if image in self.cache: return self.cache[image] else: self.cache[image] =texture= Texture.empty(image.width, image.height) texture.upload(image.data) return texture