Is there a way to render a tick mark using pygame? I tried using the unicode directly like this:
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)
But this just draws a rectangle.
This 'rectangle' that is being written is in fact the representation of the ✓
sign using a pygame.font.get_default_font()
. In order to display a ✓
sign you need to be sure, that this sign is included in a font that you are using. I propose the following solution:
font = pygame.font.Font("seguisym.ttf", size)
write(window, u'\u2713', self.color, position, size)
method or directly using write(screen, "✓", self.color, position, size)