【发布时间】:2020-11-18 05:32:11
【问题描述】:
我正在编写使用 pygame 制作游戏的教程,但在显示屏幕时遇到问题。这是我目前所拥有的:
import pygame
# Initialize the pygame
pygame.init()
# Create the screen, height = 800, width = 600
screen = pygame.display.set_mode((800, 600))
# Game Loop
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
我安装了 pygame,并且在 PyCharm 中没有错误或警告。当我运行它时(在 PyCharm 和我的终端中),我没有屏幕显示,所发生的只是 python 跑步者的宇宙飞船在我的码头上弹跳。当我在我的电脑上运行这个确切的代码时,它会显示一个黑屏,这是预期的结果。
谁能帮忙,还是我做错了什么?
感谢您的帮助。
【问题讨论】:
标签: python python-3.x macos pygame