import sys
import pygame
screen = pygame.display.set_mode((900,600))
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
screen.fill((135,206,250))
pygame.display.flip()
尝试过其他数值 运行窗口还是黑色
环境 Windows 11
pygame 2.1.3.dev8 (SDL 2.0.22,Python 3.11.0)
很可能是你的while循环阻塞了线程,screen.fill无法运行,可以去掉while后试试。如果去掉之后还无法得到想要的效果建议考虑换一种写法,我很久没用pygame了所以对fill的用法不了解