# HG changeset patch # User Neil Muller # Date 1359459180 -7200 # Node ID 3a00c933773157419e2045733f60b679e856f2f6 # Parent c5171ad0c3cd9a75104e723dcd369480b1e87b87 Add centre parameter to InteractText diff -r c5171ad0c3cd -r 3a00c9337731 pyntnclick/scenewidgets.py --- 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):