Add method updating text in UiText

This commit is contained in:
Michał Czekański 2020-04-05 23:57:28 +02:00
parent f7fb38b7ff
commit 0add2066e2

View File

@ -24,3 +24,11 @@ class UiText(UiElement):
self.image.fill(backgroundColor)
wordImage = self.font.render(text, antialias, textColor)
self.image.blit(wordImage, (0, 0))
def changeText(self, newText):
self.text = newText
if self.backgroundColor is not None:
self.image.fill(self.backgroundColor)
wordImage = self.font.render(self.text, self.antialias, self.textColor)
self.image.blit(wordImage, (0, 0))