这几行
python 3.2代码使用最新的pygame模块来移动图像.它与此示例有关:
http://www.pygame.org/docs/tut/MoveIt.html
这是我的代码:
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
我发现了类似的问题,但答案表明问题是使用函数名称作为变量,这不是我正在做的事情.我似乎无法弄清楚这里有什么问题.