def setImage(self, image, attribute='base_image'): if isinstance(image, str): image = data.load_image(image).texture elif hasattr(image, 'texture'): image = image.texture setattr(self, attribute, image) if attribute == 'base_image': self.image = self.base_image self.setDirty()
def __init__(self, parent, image, is_blended=True, color=None, **kw): if image is None and file is None: raise ValueError, 'image or file required' if isinstance(image, str): image = data.load_image(image) elif hasattr(image, 'texture'): image = image.texture self.parent = parent self.color = util.parse_color(color) super(Image, self).__init__(parent, is_blended=is_blended, **kw) self.setImage(image)