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()这是错误iam geeting:
回溯(最近一次调用):
文件"",第19行,在run_game()中
文件"",第14行,in run_game if event.type() == pygame.QUIT:
TypeError:“int”对象不可调用
if event.type() == pygame.QUIT:如果我一直这样下去,我也会出错
发布于 2018-05-24 10:19:20
看起来event.type是一个整数,而不是一个函数,所以请尝试:
if event.type == pygame.QUIT:https://stackoverflow.com/questions/50499964
复制相似问题