Mercurial > boomslang
comparison pyntnclick/widgets/base.py @ 670:fe7023750b20 pyntnclick
Add convert_color function
author | Stefano Rivera <stefano@rivera.za.net> |
---|---|
date | Sun, 12 Feb 2012 18:00:18 +0200 |
parents | b8cc0be3a819 |
children | 55d5d384fc16 |
comparison
equal
deleted
inserted
replaced
669:562f8133bb07 | 670:fe7023750b20 |
---|---|
149 surface.blit(border, expandrect) | 149 surface.blit(border, expandrect) |
150 background = pygame.Surface(self.rect.size, SRCALPHA) | 150 background = pygame.Surface(self.rect.size, SRCALPHA) |
151 background.fill(pygame.Color('gray')) | 151 background.fill(pygame.Color('gray')) |
152 surface.blit(background, self.rect) | 152 surface.blit(background, self.rect) |
153 super(Box, self).draw(surface) | 153 super(Box, self).draw(surface) |
154 | |
155 | |
156 def convert_color(color): | |
157 """Give me a pygame Color, dammit""" | |
158 if isinstance(color, pygame.Color): | |
159 return color | |
160 if isinstance(color, basestring): | |
161 return pygame.Color(color) | |
162 return pygame.Color(*color) |