comparison gamelib/hand.py @ 57:4f9d412d83db

Use hand icon from openclipart
author Neil Muller <neil@dip.sun.ac.za>
date Mon, 23 Aug 2010 14:01:00 +0200
parents 8771d545a493
children 213e47dea4d0
comparison
equal deleted inserted replaced
56:75bf3d3689e9 57:4f9d412d83db
1 # Button for the hand image 1 # Button for the hand image
2
3 from constants import BUTTON_SIZE
2 4
3 from albow.controls import ImageButton 5 from albow.controls import ImageButton
4 from albow.resource import get_image 6 from albow.resource import get_image
5 from albow.utils import frame_rect 7 from albow.utils import frame_rect
6 from pygame.color import Color 8 from pygame.color import Color
9 from pygame.rect import Rect
7 10
8 class HandButton(ImageButton): 11 class HandButton(ImageButton):
9 """The fancy hand button for the widget""" 12 """The fancy hand button for the widget"""
10 13
11 sel_colour = Color('red') 14 sel_colour = Color('red')
12 sel_width = 2 15 sel_width = 2
13 16
14 def __init__(self, action): 17 def __init__(self, action):
15 # FIXME: Yes, please. 18 # FIXME: Yes, please.
16 this_image = get_image('items', 'square.png') 19 this_image = get_image('items', 'hand.png')
17 ImageButton.__init__(self, image=this_image, action=action) 20 ImageButton.__init__(self, image=this_image, action=action)
18 self.selected = False # Flag if we're selected 21 self.selected = False # Flag if we're selected
22 self.set_rect(Rect(0, 0, BUTTON_SIZE, BUTTON_SIZE))
19 23
20 def draw(self, surface): 24 def draw(self, surface):
21 """Draw the widget""" 25 """Draw the widget"""
22 ImageButton.draw(self, surface) 26 ImageButton.draw(self, surface)
23 if self.selected: 27 if self.selected: