pygame窗口打开并立即关闭

时间:2020-08-20 00:21:18

标签: image pygame

该程序运行良好,无需尝试加载图像。 尝试打开它时,pygame窗口打开并立即消失。 (我是编程的新手)

    import pygame

    pygame.init()
    screen = pygame.display.set_mode((800, 600))
    background = pygame.image.load('togepi.png')

    pygame.display.set_caption("Mugiwara")

    #Game Loop

    running = True
    while running:
       screen.fill((0, 0, 0))
       screen.blit(background, (0,0))
       for event in pygame.event.get():
          if event.type == pygame.QUIT:
              running = False][1]

0 个答案:

没有答案