Typeerror:'tuple'对象在pygame中不可调用

时间:2017-06-06 10:36:50

标签: python pygame

当我运行此代码时:

SURFACER = SURFACEFONT.get_rect()
SURFACER.center(400, (ipnum*100))

我收到此错误:

File "index.py", line 62, in <module>
    myFunction()
  File "index.py", line 55, in drawGamesToScreen
    SURFACER.center(400, ipnum*100)
TypeError: 'tuple' object is not callable

1 个答案:

答案 0 :(得分:2)

center实例上的

Rect会返回一个元组,因此您无法在此处使用.center(x,y)。就像这样一个新的元组:

SURFACER.center = (400, (ipnum*100))