view pyntnclick/widgets/imagebutton.py @ 611:4fcc389f4d40 pyntnclick

Remove regen-speech
author Stefano Rivera <stefano@rivera.za.net>
date Sat, 11 Feb 2012 21:08:35 +0200
parents 08647ef4d324
children fdc63049b08c
line wrap: on
line source

import pygame

from pyntnclick.widgets.base import Button


class ImageButtonWidget(Button):
    """An image that is also a button. Whatever next?"""

    def __init__(self, rect, image):
        if not isinstance(rect, pygame.Rect):
            rect = pygame.Rect(rect, image.get_size())
        super(ImageButtonWidget, self).__init__(rect)
        self.image = image

    def draw(self, surface):
        surface.blit(self.image, self.rect)