pygame.error: video system not initialized

后端 未结 8 1229
情深已故
情深已故 2020-12-11 05:42

so I get this error when I try to run my pygame code: pygame.error: video system not initialized

i specify where the wing IDE tells me it is in the code below

8条回答
  •  青春惊慌失措
    2020-12-11 06:17

    I made some modifications to your code:

    import os
    import sys
    import math
    import pygame
    import pygame.mixer
    from pygame.locals import *
    
    pygame.init()
    black = 0, 0, 0
    white = 255, 255, 255
    red = 255, 0, 0
    green = 0, 255, 0
    blue = 0, 0, 255
    
    screen = pygame.display.set_mode((600, 400))
    
    clock = pygame.time.Clock()
    
    pygame.display.set_caption("Physics")
    
    
    while True:
        clock.tick(120)
    
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                pygame.quit()
        screen.fill(green)
    
        pygame.display.flip()
    

提交回复
热议问题