diff options
-rwxr-xr-x | src/api/MultiLabel.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/api/MultiLabel.py b/src/api/MultiLabel.py index e6af4b6..fdaaa3e 100755 --- a/src/api/MultiLabel.py +++ b/src/api/MultiLabel.py @@ -4,7 +4,7 @@ from Sprite import CSprite import pygame
class CMultiLabel(CSprite):
- """ accepts a list of strings, creates a multi-line
+ """ accepts a string separate with \n, creates a multi-line
label to display text
same properties as label except textLines
is a list of strings. There is no text
@@ -17,10 +17,7 @@ class CMultiLabel(CSprite): CSprite.__init__(self)
self.text = 'This\nis\nsample\ntext'
#self.font = pygame.font.Font("freesansbold.ttf", 20)
- #TODO: Esto no debe ir aca. Porque este no anda y el de CSuperSprite si ?
- #pygame.font.init()
- #print "CMultilabel"
- #print pygame.font.get_init()
+
self.font = pygame.font.Font('assets/fonts/DejaVuSans.ttf', 20)
self.fgColor = ((0x00, 0x00, 0x00))
self.bgColor = ((0xFF, 0xFF, 0xFF))
@@ -43,6 +40,7 @@ class CMultiLabel(CSprite): def createImage(self):
self.image = pygame.Surface(self.size)
self.image.fill(self.bgColor)
+
self.textLines = self.text.split('\n')
numLines = len(self.textLines)
vSize = self.image.get_height() / numLines
|