# HG changeset patch # User Simon Cross # Date 1283038564 -7200 # Node ID 03dcb25d837020f154b2ba1ffa4f819923a676c3 # Parent 54853e61b149c226a6b5fb182e1c84ad20e423c0 Slightly prettier Close button labels. diff -r 54853e61b149 -r 03dcb25d8370 gamelib/widgets.py --- a/gamelib/widgets.py Sun Aug 29 01:29:24 2010 +0200 +++ b/gamelib/widgets.py Sun Aug 29 01:36:04 2010 +0200 @@ -10,6 +10,7 @@ from albow.resource import get_font, get_image from pygame.color import Color from pygame.rect import Rect +from pygame.draw import lines from pygame import mouse from constants import BUTTON_SIZE @@ -74,8 +75,9 @@ class BoomButton(BoomLabel): def __init__(self, text, action, screen): - super(BoomLabel, self).__init__(text, font=get_font(20, 'Vera.ttf')) + super(BoomLabel, self).__init__(text, font=get_font(20, 'Vera.ttf'), margin=4) self.bg_color = (0, 0, 0) + self._frame_color = Color(50, 50, 50) self.action = action self.screen = screen @@ -86,6 +88,15 @@ def mouse_move(self, event): self.screen.state.highlight_override = True + def draw(self, surface): + super(BoomButton, self).draw(surface) + r = surface.get_rect() + w = 2 + top, bottom, left, right = r.top, r.bottom, r.left, r.right + lines(surface, self._frame_color, False, [ + (left, bottom), (left, top), (right-w, top), (right-w, bottom) + ], w) + class MessageDialog(BoomLabel, CursorWidget):