import sys
import pygame
class AlienInvasion: # 管理 资源与类 的类
def _init_(self):
pygame.init()
self.screen = pygame.display.set_mode((1200, 800))
pygame.display.set_caption("Alien Invasion")
# self.bg_color = (230, 230, 230)
def run_game(self): # 开始游戏主循环
while True:
# supervise keyboard and mouse item
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
# visualiaze the window
pygame.display.flip()
if __name__ == ' _main_':
# 创建并运行游戏
ai = AlienInvasion()
ai.run_game()

关于#pygame#无窗口弹出的问题,如何解决?
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-