Why does this code freeze? {Pros only} Introducing an entry box ---Part 2
PART 1 [SOLVED] Hey there everyone. I need your help. I have been working on a school project lately with Pygame, but have reached a point where I don't know what to do. Here is the code: [UPDATED --------- PART 2] Now I need to introduce the code of the the entry box on this code, but without causing any clashes. Any help? import pygame import random pygame.init() clock = pygame.time.Clock() surface = pygame.display.set_mode((600, 400)) pygame.display.set_caption("Projecte MatZanfe") font = pygame.font.SysFont('comicsans', 50) base_font = pygame.font.Font(None, 32) user_text = '' color_active = pygame.Color('lightskyblue3') running = True def start_the_game(): x = random.randint(0, 10) y = random.randint(0, 10) is_correct = False return x, y def display_the_game(x, y): # Variables points = 0 z = x + y surface.fill((255, 70, 90)) text = font.render(str(x) + "+" + str(y), True, (255, 255, 255)) input_rect = pygame.Rect(200, 200, 180, 50) pygame.draw.rect(surface, color_active, input_rect) text_surface = base_font.render(user_text, True, (255, 255, 255)) surface.blit(text_surface, input_rect) surface.blit(text, (260, 120)) input_rect.w = max(100, text_surface.get_width() + 10) x, y = start_the_game() while running: clock.tick(60) for event in pygame.event.get(): if event.type == pygame.QUIT: running = False display_the_game(x, y) pygame.display.update() pygame.quit()