comparison pyntnclick/tools/rect_drawer.py @ 748:763ff5a9ee42 pyntnclick

Work around multiple prepare calling bug
author Neil Muller <neil@dip.sun.ac.za>
date Sun, 20 Jan 2013 18:03:28 +0200
parents 960af9761fb0
children 0548894408a8
comparison
equal deleted inserted replaced
747:960af9761fb0 748:763ff5a9ee42
564 def __init__(self, rect, gd, app_image): 564 def __init__(self, rect, gd, app_image):
565 self.app_image = app_image 565 self.app_image = app_image
566 super(ModeLabel, self).__init__(rect, 566 super(ModeLabel, self).__init__(rect,
567 gd, 'Mode : ', fontname=constants.bold_font, 567 gd, 'Mode : ', fontname=constants.bold_font,
568 fontsize=15, color=pygame.color.Color(128, 0, 255)) 568 fontsize=15, color=pygame.color.Color(128, 0, 255))
569 self.start_rect = self.rect.copy()
569 570
570 def draw(self, surface): 571 def draw(self, surface):
571 self.do_prepare() 572 self.do_prepare()
572 text = 'Mode : %s' % self.app_image.mode 573 text = 'Mode : %s' % self.app_image.mode
573 if self.text != text: 574 if self.text != text:
574 self.text = text 575 self.text = text
575 self.prepare() 576 self.is_prepared = False
577 self.rect = self.start_rect.copy()
578 self.do_prepare()
576 super(ModeLabel, self).draw(surface) 579 super(ModeLabel, self).draw(surface)
577 580
578 581
579 def make_button(text, gd, action, ypos): 582 def make_button(text, gd, action, ypos):
580 rect = pygame.rect.Rect(0, 0, constants.menu_width, 583 rect = pygame.rect.Rect(0, 0, constants.menu_width,