import pygame def draw_text(text, color, surface, x, y, text_size=30, is_bold=False): if is_bold: font = pygame.font.Font('resources/fonts/Poppins-SemiBold.ttf', text_size) else: font = pygame.font.Font('resources/fonts/Poppins-Regular.ttf', text_size) textobj = font.render(text, 1, color) textrect = textobj.get_rect() textrect.topleft = (x, y) surface.blit(textobj, textrect)