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, transforms=(EIGHT_BIT,)):
12 super(ImageBox, self).__init__(pos)
14 self.transforms = transforms
17 self.surface = resources.get_image(
18 self.image, transforms=self.transforms)
19 self.size = self.surface.get_rect().size
21 def draw(self, surface):
22 surface.blit(self.surface, self.rect)