Mercurial > mamba
view mamba/widgets/base.py @ 41:3f44c30a1c39
Correct Text placement
author | Stefano Rivera <stefano@rivera.za.net> |
---|---|
date | Sun, 11 Sep 2011 15:08:16 +0200 |
parents | 047273a63054 |
children | 792c8429681a |
line wrap: on
line source
import pygame class Widget(object): def __init__(self, rect): if not isinstance(rect, pygame.Rect): rect = pygame.Rect(rect, (0, 0)) self.rect = rect def event(self, event): "Override me" pass def draw(self, surface): "Override me" pass class Container(object): def __init__(self): self.children = [] def event(self, event): for child in self.children: # TODO mouse events child.event(event) def add(self, widget): self.children.append(widget) def draw(self, surface): for child in self.children: child.draw(surface)