From 237c4215b45bde3e5f6fe769f7b8f2955590e34e Mon Sep 17 00:00:00 2001 From: Neil Date: Sat, 17 May 2014 23:36:15 +0200 Subject: [PATCH] Add PreRenderedImageBox widget --- naja/widgets/image_box.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/naja/widgets/image_box.py b/naja/widgets/image_box.py index 32787df..e9b4bf3 100644 --- a/naja/widgets/image_box.py +++ b/naja/widgets/image_box.py @@ -22,3 +22,18 @@ class ImageBox(Widget): def draw(self, surface): surface.blit(self.surface, self.rect) + + +class PreRenderedImageBox(Widget): + """Hold an image given as a surface""" + + def __init__(self, pos, image): + super(PreRenderedImageBox, self).__init__(pos) + self.surface = image.copy() + + def prepare(self): + self.size = self.surface.get_rect().size + + def draw(self, surface): + surface.blit(self.surface, self.rect) + -- 2.34.1