如何打开pygame窗口无法启动?

时间:2020-03-13 21:47:51

标签: python python-3.x macos pygame macos-catalina

我正在通过“ Python Crash Course”制作游戏,但是在显示pygame窗口时遇到问题。看起来好像Python Launcher应用正在尝试启动,但没有任何反应,Python Launcher的图标在Dock中弹跳而已。

import sys

import pygame

def run_game():
    #Initilize game and create a screen object.

    pygame.init()
    pygame.display.init()
    screen = pygame.display.set_mode((1200, 800))
    pygame.display.set_caption("Alien Invasion")

#Start the main loop for the game.

    while True:

    # Watch for keyboard and mouse events.
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                sys.exit()

    # Make the most recently drawn screen visible.
        pygame.display.flip()

run_game()

有什么解决办法吗? 非常感谢您的帮助!

upd。我正在使用MacOS Catalina。

0 个答案:

没有答案