1 """Widget to draw an image"""
3 from naja.resources import resources
4 from naja.resources.mutators import EIGHT_BIT
5 from naja.widgets.base import Widget
8 class ImageBox(Widget):
9 """Widget which holds an image."""
11 def __init__(self, pos, image, eight_bit=True, transforms=()):
12 super(ImageBox, self).__init__(pos)
15 transforms = (EIGHT_BIT,) + transforms
16 self.transforms = transforms
19 self.surface = resources.get_image(
20 self.image, transforms=self.transforms)
21 self.size = self.surface.get_rect().size
23 def draw(self, surface):
24 surface.blit(self.surface, self.rect)