【发布时间】:2015-07-20 00:48:31
【问题描述】:
我一直在关注关于如何在 pygame 中制作游戏的 youtube 系列,我不断收到有关 QUIT 事件的错误,我不知道如何解决它。
这是错误:
Traceback (most recent call last):
File "C:/Users/Brady/Desktop/Python Programs/Climber.py", line 31, in <module>
if event.type == pygame.QUIT():
TypeError: 'int' object is not callable
代码如下:
#Imports
import pygame
import sys
import random
import cx_Freeze
#Variables
playerhealth = 100
black = (0, 0, 0)
white = (255, 255, 255)
red = (255, 0, 0)
green = (0 ,255, 0)
#Functions
#Initialization
pygame.init()
gamedisplay = pygame.display.set_mode((800, 800))
pygame.display.set_caption("Climber")
#Game Loop
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT():
pygame.quit()
quit()
gamedisplay.fill(white)
pygame.display.update()
请帮助我解决此错误以及代码中的任何其他错误。
【问题讨论】:
-
Climber.py第 31 行有什么内容? -
@jm_____ if event.type == pygame.QUIT():
标签: python events int pygame callable