def render(self, at):
        # draw bg
        surf = self.surf
        surf.fill(BASE3)
        bg = pygame.Surface((self.size[0], self.bar_height))
        bg.fill(BASE2)
        surf.blit(bg, (0, 0))
        # draw bar
        ratio = self.gauge.get(at) / float(self.gauge.max(at))
        if ratio > 1:
            bar_color = BLUE
            ratio = 1
        elif ratio == 1:
            bar_color = CYAN
        elif ratio > 0.3:
            bar_color = GREEN
        elif ratio > 0.1:
            bar_color = YELLOW
        elif ratio > 0:
            bar_color = ORANGE
        if ratio > 0:
            bar = pygame.Surface((int(self.size[0] * ratio), self.bar_height))
            bar.fill(bar_color)
            surf.blit(bar, (0, 0))
        # write current state
        text = font.render('{0}/{1}'.format(
            int(self.gauge.get(at)), self.gauge.max(at)), True, BASE1)
        surf.blit(text, (10, font.get_height() / 2))
        # write time recover in
        speed = self.gauge.velocity(at)
        if speed != 0:
            text = font.render('{0:+.2f}/s'.format(speed), True,
                               GREEN if speed > 0 else RED)
            surf.blit(text, (surf.get_width() - text.get_width() - 10,
                             font.get_height() / 2))
        '''
        try:
            move_in = self.gauge.momenta[0].move_in(self.gauge, at)
        except (AttributeError, IndexError):
            pass
        else:
            if move_in:
                move_in = math.ceil(move_in)
                text = font.render('{0:02.0f}:{1:02.0f}'.format(
                    move_in / 60, move_in % 60), True, text_colors[1])
                surf.blit(text, (surf.get_width() - text.get_width() - 10,
                                 font.get_height() / 2))
        '''
        return surf
def render ( self , at ) : surf = self . surf surf . fill ( BASE3 ) bg = pygame . Surface ( ( self . size [ 0 ] , self . bar_height ) ) bg . fill ( BASE2 ) surf . blit ( bg , ( 0 , 0 ) ) ratio = self . gauge . get ( at ) / float ( self . gauge . max ( at ) ) if ratio > 1 : bar_color = BLUE ratio = 1 elif ratio == 1 : bar_color = CYAN elif ratio > 0.3 : bar_color = GREEN elif ratio > 0.1 : bar_color = YELLOW elif ratio > 0 : bar_color = ORANGE if ratio > 0 : bar = pygame . Surface ( ( int ( self . size [ 0 ] * ratio ) , self . bar_height ) ) bar . fill ( bar_color ) surf . blit ( bar , ( 0 , 0 ) ) text = font . render ( '{0}/{1}' . format ( int ( self . gauge . get ( at ) ) , self . gauge . max ( at ) ) , True , BASE1 ) surf . blit ( text , ( 10 , font . get_height ( ) / 2 ) ) speed = self . gauge . velocity ( at ) if speed != 0 : text = font . render ( '{0:+.2f}/s' . format ( speed ) , True , GREEN if speed > 0 else RED ) surf . blit ( text , ( surf . get_width ( ) - text . get_width ( ) - 10 , font . get_height ( ) / 2 ) ) '''
        try:
            move_in = self.gauge.momenta[0].move_in(self.gauge, at)
        except (AttributeError, IndexError):
            pass
        else:
            if move_in:
                move_in = math.ceil(move_in)
                text = font.render('{0:02.0f}:{1:02.0f}'.format(
                    move_in / 60, move_in % 60), True, text_colors[1])
                surf.blit(text, (surf.get_width() - text.get_width() - 10,
                                 font.get_height() / 2))
        ''' return surf
try:
            move_in = self.gauge.momenta[0].move_in(self.gauge, at)
        except (AttributeError, IndexError):
            pass
        else:
            if move_in:
                move_in = math.ceil(move_in)
                text = font.render('{0:02.0f}:{1:02.0f}'.format(
                    move_in / 60, move_in % 60), True, text_colors[1])
                surf.blit(text, (surf.get_width() - text.get_width() - 10,
                                 font.get_height() / 2))