How to make a string’s content appears on screen as we type on keyboard?

I have this function, where player can type his name, but I want each letter to appear on the screen as he types them. Here is my function : def input_player_name(): player_name_screen = True name = "" win.blit(player_name_bg, (0, 0)) while player_name_screen: for event in pygame.event.get(): if event.type == pygame.KEYDOWN: if event.key == pygame.K_RETURN: print(name) … Read more