首页 > 解决方案 > 如何在pygame中显示一个utf-8字符?

问题描述

有没有办法使用 pygame 渲染刻度线?我尝试像这样直接使用unicode:

def write(screen, text, color, position, size):
    font = pygame.font.Font(pygame.font.get_default_font(), size)# Defining a font with font and size
    text_surface = font.render(text, True, color)# Defining the text color which will be rendered
    screen.blit(text_surface, (position[0], position[1])) # Rendering the font

write(window, u'\u2713', self.color, position, size) 

但这只是画了一个矩形。

标签: pythonpygametext-rendering

解决方案



推荐阅读