projects
/
naja.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a6de62b
)
Add PreRenderedImageBox widget
author
Neil
<neil@dip.sun.ac.za>
Sat, 17 May 2014 21:36:15 +0000
(23:36 +0200)
committer
Neil
<neil@dip.sun.ac.za>
Sat, 17 May 2014 21:37:20 +0000
(23:37 +0200)
naja/widgets/image_box.py
patch
|
blob
|
history
diff --git
a/naja/widgets/image_box.py
b/naja/widgets/image_box.py
index 32787dfce793d9813a904e899ba55cf81be2c0bd..e9b4bf398d4e941dc731d795338e7e79324ca0b5 100644
(file)
--- 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)
+