X-Git-Url: https://git.ctpug.org.za/?a=blobdiff_plain;f=naja%2Fwidgets%2Ftext.py;h=53030c55b8ad730c4a7725f07dc1bf9c5dcf1f52;hb=847d271607652c00e62298a37987aae452719b61;hp=39178ed8777ee3e500276b95c975993721e681e2;hpb=18eaa15b16160df3dcd23dd2773603d1f2e179ce;p=naja.git diff --git a/naja/widgets/text.py b/naja/widgets/text.py index 39178ed..53030c5 100644 --- a/naja/widgets/text.py +++ b/naja/widgets/text.py @@ -1,6 +1,9 @@ +import pygame + from naja.constants import FONT, FONT_SIZE from naja.widgets.base import Widget from naja.resources import resources +from naja.utils import convert_colour class TextWidget(Widget): @@ -10,12 +13,15 @@ class TextWidget(Widget): self.text = text self.fontname = fontname or FONT - self.fontsize = fontsize or FONT_SIZE - self.colour = colour or (0, 0, 0) + self.fontsize = (fontsize or FONT_SIZE) / 2 + self.colour = convert_colour(colour or (0, 0, 0)) def prepare(self): self.font = resources.get_font(self.fontname, self.fontsize) - self.surface = self.font.render(self.text, True, self.colour) + text = self.font.render(self.text, True, self.colour) + text_rect = text.get_rect() + self.surface = pygame.transform.scale(text, (text_rect.width * 2, + text_rect.height * 2)) self.size = self.surface.get_rect().size def draw(self, surface):