diff pyntnclick/widgets/imagebutton.py @ 604:08647ef4d324 pyntnclick

ImageButtons have sizes.
author Jeremy Thurgood <firxen@gmail.com>
date Sat, 11 Feb 2012 20:11:58 +0200
parents 0ae62d824d2f
children fdc63049b08c
line wrap: on
line diff
--- a/pyntnclick/widgets/imagebutton.py	Sat Feb 11 20:09:47 2012 +0200
+++ b/pyntnclick/widgets/imagebutton.py	Sat Feb 11 20:11:58 2012 +0200
@@ -1,3 +1,5 @@
+import pygame
+
 from pyntnclick.widgets.base import Button
 
 
@@ -5,6 +7,8 @@
     """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