diff pytouhou/game/text.py @ 730:f2c3848dabff

PyTouhou: Fix text comparison to be done after encoding to bytes
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sun, 08 Dec 2019 20:14:28 +0100
parents e15672733c93
children
line wrap: on
line diff
--- a/pytouhou/game/text.py
+++ b/pytouhou/game/text.py
@@ -116,12 +116,12 @@ class Text(GlyphCollection):
 
 
     def set_text(self, text):
+        if isinstance(text, str):
+            text = text.encode()
+
         if text == self.text:
             return
 
-        if isinstance(text, str):
-            text = text.encode()
-
         self.set_sprites([c - self.shift for c in text])
         self.text = text
         self.changed = True