The Python Game Book

code games. learn Python.

User Tools

Site Tools





since python3, you can use unicode inside strings and even as variable names.


how to encode a specific unicode char

  • pygame: use the pygame.font.Font or the newer pygame.freetype.Font to load the fond. The fond must contain the unicode glyphs. For example, use DejaVuSans
  • look up (at pdf or wikipedia) the unicode for the glyph you want to draw.
    • if the unicode has only 4 chars, like 12BB, use “\u12BB”
    • if the unicode has more than 4 chars, like 1F345, fill with leading zeros so that the lenght is 8, and use an uppercase U: “\U0001F345”
en/glossary/t/u/unicode.txt · Last modified: 2020/09/29 16:53 by horst