Home > front end >  How do I fix pygame.error: video system not initialized in replit
How do I fix pygame.error: video system not initialized in replit

Time:01-01

I'm playing around with Pygame, and when I clicked Run for the first time, Pygame gives me the error

pygame.error: video system not initialized

How do I fix this?

The code I have at the moment is

import pygame

pygame.init()

white = (255, 255, 255)
green = (0, 255, 0)
blue = (0, 0, 128)
X = 400
Y = 400
display_surface = pygame.display.set_mode((X, Y))
pygame.display.set_caption('Epic SAVER')
font = pygame.font.Font('freesansbold.ttf', 32)
text = font.render('Epic SAVER', True, green, blue)
textRect = text.get_rect()
textRect.center = (X // 2, Y // 2)

while True:
    display_surface.fill(white)
    display_surface.blit(text, textRect)
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
    pygame.display.update()

I'm running this in Replit, and how would I fix this? I got this off of the internet because I don't know Pygame that well

CodePudding user response:

  • Related