changeset 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 f953ae5b3732
children ca46b4312df1
files pytouhou/game/text.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/pytouhou/game/text.py	Sun Dec 08 20:13:01 2019 +0100
+++ b/pytouhou/game/text.py	Sun Dec 08 20:14:28 2019 +0100
@@ -116,12 +116,12 @@
 
 
     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