3
这几行python 3.2代码使用最新的pygame模块来移动图像。它关系到这个例子: http://www.pygame.org/docs/tut/MoveIt.htmlPygame TypeError:'int'对象不可调用
这里是我的代码:
import pygame
import sys
pygame.init()
screen = pygame.display.set_mode((600,400))
bg = pygame.image.load('bg.jpg')
player = pygame.image.load('player.jpg')
pos = player.get_rect()
while True:
for i in pygame.event.get():
if i.type() == pygame.QUIT:
sys.exit()
screen.blit(bg,(0,0))
screen.blit(player,(i,i))
pygame.display.update()
以下是错误运行它时,我得到:
Traceback (most recent call last):
File "C:/Users/Grounds Keeper Willy/Desktop/Python Code/test.py", line 12, in
if i.type() == pygame.QUIT:
TypeError: 'int' object is not callable
我也发现了类似的问题,但在答案指出,问题是使用函数名称作为变量,这不是我正在做的。我似乎无法弄清楚这里有什么问题。