Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How do I fix pygame.error: video system not initialized in replit

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?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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

>Solution :

replit.com allows creating Python/PyGame scripts and multiplayer coding. When creating a new repl, select the Pygame template:

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading