One true import-style
[naja.git] / naja / widgets / tile.py
1 # These will probably need to go away when we have images
2 import pygame
3 import pygame.locals as pgl
4
5 from naja.constants import TILE_SIZE
6 from naja.resources import resources
7 from naja.widgets.base import Widget
8
9
10 class TileWidget(Widget):
11     """Widget which holds a tile on the game board."""
12     def __init__(self, pos, image=None):
13         super(TileWidget, self).__init__(pos, TILE_SIZE)
14         self.image = image
15
16     def prepare(self):
17         # Placeholder logic - just draw the outline of a square
18         self.surface = pygame.surface.Surface(TILE_SIZE)
19         pygame.draw.lines(self.surface, pgl.color.THECOLORS['yellow'],
20                           True, [(1, 1), (1, 95), (95, 95), (95, 1)], 2)
21         self.surface.convert_alpha(pygame.display.get_surface())
22         self.size = self.surface.get_rect().size
23
24     def draw(self, surface):
25         surface.blit(self.surface, self.rect)