1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
import pygame
from DrawableObject import DrawableObject
class DrawableFontObject(DrawableObject, pygame.sprite.Sprite):
def __init__(self,text,font, x = 0, y = 0):
self.font = font
self.textImage = font.render(text, 1, (255,255,255))
self.text = text
DrawableObject.__init__(self, [self.textImage], '')
def changeText(self, newText, color=(0,0,0)):
self.text = newText
self._images[0] = self.font.render(str(newText), True, color)
self.image = self._images[0]
def getText(self):
return str(self.text)
|