# HG changeset patch # User Stefano Rivera # Date 1315746496 -7200 # Node ID 3f44c30a1c39a9d89c0c2f4a8c8b1d50c028de90 # Parent 967762f042f82380c06720a97955c29020d3f43f Correct Text placement diff -r 967762f042f8 -r 3f44c30a1c39 mamba/habitats/mainmenu.py --- a/mamba/habitats/mainmenu.py Sun Sep 11 15:06:07 2011 +0200 +++ b/mamba/habitats/mainmenu.py Sun Sep 11 15:08:16 2011 +0200 @@ -8,4 +8,4 @@ def __init__(self): super(MainMenu, self).__init__() - self.container.add(TextWidget((20, 20), "Hello", color='white')) + self.container.add(TextWidget((100, 100), "Hello", color='white')) diff -r 967762f042f8 -r 3f44c30a1c39 mamba/widgets/base.py --- a/mamba/widgets/base.py Sun Sep 11 15:06:07 2011 +0200 +++ b/mamba/widgets/base.py Sun Sep 11 15:08:16 2011 +0200 @@ -5,7 +5,8 @@ def __init__(self, rect): if not isinstance(rect, pygame.Rect): - rect = pygame.Rect(rect[0], rect[1], 0, 0) + rect = pygame.Rect(rect, (0, 0)) + self.rect = rect def event(self, event): "Override me" diff -r 967762f042f8 -r 3f44c30a1c39 mamba/widgets/text.py --- a/mamba/widgets/text.py Sun Sep 11 15:06:07 2011 +0200 +++ b/mamba/widgets/text.py Sun Sep 11 15:08:16 2011 +0200 @@ -23,7 +23,7 @@ if not isinstance(self.color, pygame.Color): self.color = pygame.Color(self.color) self.surface = self.font.render(self.text, True, self.color) - self.rect = self.surface.get_rect() + self.rect.width, self.rect.height = self.surface.get_rect().size def draw(self, surface): surface.blit(self.surface, self.rect)