Mercurial > touhou
diff pytouhou/game/text.py @ 590:e15672733c93
Switch to Python 3.x instead of 2.7.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Tue, 30 Sep 2014 17:14:24 +0200 |
parents | e35bef07290d |
children | f2c3848dabff |
line wrap: on
line diff
--- a/pytouhou/game/text.py +++ b/pytouhou/game/text.py @@ -98,7 +98,7 @@ class GlyphCollection(Widget): class Text(GlyphCollection): - def __init__(self, pos, ascii_anm, back_anm=None, text='', + def __init__(self, pos, ascii_anm, back_anm=None, text=b'', xspacing=14, shift=21, back_script=22, align='left'): GlyphCollection.__init__(self, pos, ascii_anm, back_anm, xspacing=xspacing, back_script=back_script) @@ -119,7 +119,10 @@ class Text(GlyphCollection): if text == self.text: return - self.set_sprites([ord(c) - self.shift for c in text]) + if isinstance(text, str): + text = text.encode() + + self.set_sprites([c - self.shift for c in text]) self.text = text self.changed = True