Exemplo n.º 1
0
    def __init__(self, surface, *groups, **styles):
        name = 'lifebar'
        size = [100, 40]
        super().__init__(name, size, *groups, **styles)

        surface_rect = pygame.rect.Rect(surface.get_rect())
        self.rect.move_ip(surface_rect.left + 20, surface_rect.bottom - 20 - self.rect.height)

        text = TextWidget(*groups, **styles)
        text.set_text(self._name)
        text.draw(self.image)
Exemplo n.º 2
0
 def __init__(self, string_to_render, surface, *groups, **styles):
     name = 'text'
     text = TextWidget(*groups, **styles)
     text.set_text(string_to_render)
     [w, h] = text.get_size()
     size = [w, h]
     super().__init__(name, size, surface, *groups, **styles)
     text.draw(self.image)