0
我编程pygame的项目,我会告诉你...pygame.init错误:视频系统未初始化
import pygame
pygame.init()
WHITE = (255, 255, 255)
pad_width = 1024
pad_height = 512
def runGame():
global gamepad, clock
crashed = False
while not crashed:
for event in pygame.event.get():
if event.type == pygame.QUIT:
crashed = True
gamepad.fill(WHITE)
pygame.display.update()
clock.tick(60)
pygame.quit()
def initGame():
global gamepad, clock
pygame.init()
gamepad = pygame.display.set_mode((pad_width, pad_height))
pygame.display.set_caption('Pyflying')
clock = pygame.time.Clock()
runGame()
initGame()
这是代码,现在的错误....
Traceback (most recent call last):
File "C:/Users/dongjune/Desktop/PyCharm/scratch.py", line 36, in <module>
initGame()
File "C:/Users/dongjune/Desktop/PyCharm/scratch.py", line 33, in initGame
runGame()
File "C:/Users/dongjune/Desktop/PyCharm/scratch.py", line 14, in runGame
for event in pygame.event.get():
pygame.error: video system not initialized
我不知道如何编程....如果你知道错误,请回答! 而且,我是pygame的新手......ㅠ。ㅠ如果你知道如何使用pygame,请告诉我!谢谢....
哦,那么你必须删除'pygame.quit()'。它在错误的地方。 – JJAACCEeEKK
好的答案!!!!!谢谢! – sjkim104