From 0add2066e2c1af94dcd53a7a730106eb98f29101 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Czeka=C5=84ski?= Date: Sun, 5 Apr 2020 23:57:28 +0200 Subject: [PATCH] Add method updating text in UiText --- src/ui/UiText.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ui/UiText.py b/src/ui/UiText.py index a6beb6a..676faf7 100644 --- a/src/ui/UiText.py +++ b/src/ui/UiText.py @@ -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))