Mercurial > pyntnclick
comparison gamelib/hand.py @ 159:ef4da30f0f38
Make hand activate on mouse down, like inventory
author | Neil Muller <neil@dip.sun.ac.za> |
---|---|
date | Wed, 25 Aug 2010 00:32:44 +0200 |
parents | 29ba5456e8b3 |
children |
comparison
equal
deleted
inserted
replaced
158:7a21a594ad57 | 159:ef4da30f0f38 |
---|---|
1 # Button for the hand image | 1 # Button for the hand image |
2 | 2 |
3 from constants import BUTTON_SIZE | 3 from constants import BUTTON_SIZE |
4 | 4 |
5 from albow.controls import ImageButton | 5 from albow.controls import Image |
6 from albow.resource import get_image | 6 from albow.resource import get_image |
7 from albow.utils import frame_rect | |
8 from pygame.color import Color | |
9 from pygame.rect import Rect | 7 from pygame.rect import Rect |
10 | 8 |
11 | 9 |
12 class HandButton(ImageButton): | 10 class HandButton(Image): |
13 """The fancy hand button for the widget""" | 11 """The fancy hand button for the widget""" |
14 | 12 |
15 def __init__(self, action): | 13 def __init__(self, action): |
16 # FIXME: Yes, please. | 14 # FIXME: Yes, please. |
17 this_image = get_image('items', 'hand.png') | 15 this_image = get_image('items', 'hand.png') |
18 ImageButton.__init__(self, image=this_image, action=action) | 16 Image.__init__(self, image=this_image) |
17 self.action = action | |
19 self.set_rect(Rect(0, 0, BUTTON_SIZE, BUTTON_SIZE)) | 18 self.set_rect(Rect(0, 0, BUTTON_SIZE, BUTTON_SIZE)) |
20 | 19 |
20 def mouse_down(self, event): | |
21 self.action() | |
22 |