changeset 826:3a00c9337731 pyntnclick

Add centre parameter to InteractText
author Neil Muller <neil@dip.sun.ac.za>
date Tue, 29 Jan 2013 13:33:00 +0200
parents c5171ad0c3cd
children 7d7790dc1e25
files pyntnclick/scenewidgets.py
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/pyntnclick/scenewidgets.py	Tue Jan 29 12:45:54 2013 +0200
+++ b/pyntnclick/scenewidgets.py	Tue Jan 29 13:33:00 2013 +0200
@@ -58,11 +58,13 @@
 
        Used so we can easily include translatable strings in the scenes"""
 
-    def __init__(self, x, y, w, h, text, color, max_font_size, font=None):
+    def __init__(self, x, y, w, h, text, color, max_font_size, font=None,
+            centre=True):
         self._text = text
         self._color = convert_color(color)
         self._max_font_size = max_font_size
         self._font = font
+        self._centre = centre
         rect = Rect((x, y), (w, h))
         super(InteractText, self).__init__(None, rect, rect)
 
@@ -73,7 +75,8 @@
             self._font = thing.gd.constants.font
         bg_color = Color(0, 0, 0, 0)  # transparent background
         self.image = render_text(self._text, self._font, font_size,
-                self._color, bg_color, thing.resource, self.rect.size)
+                self._color, bg_color, thing.resource, self.rect.size,
+                self._centre)
 
 
 class InteractRectUnion(Interact):