view pyntnclick/widgets/imagebutton.py @ 854:3577c51029f1 default tip

Remove Suspended Sentence. pyntnclick is the library we extracted from it
author Stefano Rivera <stefano@rivera.za.net>
date Sat, 21 Jun 2014 22:15:54 +0200
parents 3a875256f795
children
line wrap: on
line source

from pyntnclick.widgets.base import Button


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

    def __init__(self, pos, gd, image, size=None):
        super(ImageButtonWidget, self).__init__(pos, gd, size)
        if not size:
            self.rect.size = image.get_rect().size
        self.image = image

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