From 41b7cd2a3fddcd5a5bcd89baab06a1aee659a4b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Czeka=C5=84ski?= Date: Sat, 4 Apr 2020 19:24:47 +0200 Subject: [PATCH] Fix font assignment in UiButton and UiText init() --- src/ui/UiButton.py | 3 ++- src/ui/UiText.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ui/UiButton.py b/src/ui/UiButton.py index 00f91ff..2eeab0d 100644 --- a/src/ui/UiButton.py +++ b/src/ui/UiButton.py @@ -13,7 +13,8 @@ class UiButton(UiElement): """ super().__init__(rect) if font is None: - self.font = pygame.font.Font(None, 25) + font = pygame.font.Font(None, 25) + self.font = font self.textColor = textColor self.clickedBtnColor = clickedBtnColor self.notClickedBtnColor = notClickedBtnColor diff --git a/src/ui/UiText.py b/src/ui/UiText.py index e3537ef..37602d2 100644 --- a/src/ui/UiText.py +++ b/src/ui/UiText.py @@ -13,5 +13,6 @@ class UiText(UiElement): if font is None: font = pygame.font.Font(None, 12) + self.font = font self.image = font.render(text, antialias, textColor, backgroundColor)