From d9c59f86a4465ac3f46b86919aa7e92925f4a5b1 Mon Sep 17 00:00:00 2001 From: csd4ni3l Date: Thu, 3 Apr 2025 22:31:50 +0200 Subject: [PATCH 1/3] Fix draw functions not initializing correctly - draw_debug was not calling init_deferred at all - draw was not checking if it was initialized already, making it very slow --- arcade/text.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arcade/text.py b/arcade/text.py index 0a521f83f6..2f6272469c 100644 --- a/arcade/text.py +++ b/arcade/text.py @@ -276,7 +276,6 @@ def __init__( z: float = 0, **kwargs, ): - self._initialized = False self._arguments = dict( text=text, x=x, @@ -645,7 +644,8 @@ def draw(self) -> None: instance. For information on how to do this, see :ref:`sprite_move_scrolling`. """ - self._init_deferred() + if not self._initialized: + self._init_deferred() _draw_pyglet_label(self.label) def draw_debug( @@ -663,6 +663,9 @@ def draw_debug( background_color: Color the content background outline_color: Color of the content outline """ + if not self._initialized: + self._init_deferred() + left = self.left right = self.right top = self.top From bbdc0313064daf099b88207082a1cb92d6678b2e Mon Sep 17 00:00:00 2001 From: csd4ni3l Date: Thu, 3 Apr 2025 22:33:46 +0200 Subject: [PATCH 2/3] Fix formatting --- arcade/text.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arcade/text.py b/arcade/text.py index 2f6272469c..f4f946027e 100644 --- a/arcade/text.py +++ b/arcade/text.py @@ -665,7 +665,7 @@ def draw_debug( """ if not self._initialized: self._init_deferred() - + left = self.left right = self.right top = self.top From 8452a990b6c6ff9f6745dd09bb2c3ba721ac551a Mon Sep 17 00:00:00 2001 From: csd4ni3l Date: Thu, 3 Apr 2025 22:45:08 +0200 Subject: [PATCH 3/3] Remove unneeded init_deferred from draw functions --- arcade/text.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/arcade/text.py b/arcade/text.py index f4f946027e..fef9a0d800 100644 --- a/arcade/text.py +++ b/arcade/text.py @@ -644,8 +644,6 @@ def draw(self) -> None: instance. For information on how to do this, see :ref:`sprite_move_scrolling`. """ - if not self._initialized: - self._init_deferred() _draw_pyglet_label(self.label) def draw_debug( @@ -663,9 +661,6 @@ def draw_debug( background_color: Color the content background outline_color: Color of the content outline """ - if not self._initialized: - self._init_deferred() - left = self.left right = self.right top = self.top