【发布时间】:2018-05-24 10:19:20
【问题描述】:
import pygame
import sys
def run_game():
pygame.init()
screen = pygame.display.set_mode((1200,800))
pygame.display.set_caption("Alien Invasion")
bg_color = (230, 230, 230)
while True:
screen.fill(bg_color)
for event in pygame.event.get():
if event.type() == pygame.QUIT:
sys.exit()
pygame.display.flip()
run_game()
这是我遇到的错误:
Traceback(最近一次通话最后一次):
文件“”,第 19 行,在 run_game()
文件“”,第 14 行,在 run_game 中 if event.type() == pygame.QUIT:
TypeError: 'int' 对象不可调用
if event.type() == pygame.QUIT:
如果我一直这样,我也会出错
【问题讨论】:
标签: python-3.x pygame