diff gamelib/custom_widgets.py @ 726:efa58c92b304 pyntnclick

Move prepare out of __init__ and into everywhere else
author Neil Muller <neil@dip.sun.ac.za>
date Tue, 15 Jan 2013 22:44:50 +0200
parents c8b683dd56d3
children bcc9277a23e6
line wrap: on
line diff
--- a/gamelib/custom_widgets.py	Tue Jan 15 21:57:42 2013 +0200
+++ b/gamelib/custom_widgets.py	Tue Jan 15 22:44:50 2013 +0200
@@ -14,7 +14,9 @@
                 bg_color=pygame.Color(255, 175, 127, 191),
                 color=pygame.Color(0, 0, 0),
                 border_color=pygame.Color(127, 15, 0))
+
+    def prepare(self):
         # Centre the widget
-        # Should this happen automatically in state?
-        self.rect.center = (gd.constants.screen[0] / 2,
-                gd.constants.screen[1] / 2)
+        super(JimLabel, self).prepare()
+        self.rect.center = (self.gd.constants.screen[0] / 2,
+                self.gd.constants.screen[1] / 2)