Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/clojure/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 类型错误:';元组';对象在pygame中不可调用_Python_Pygame - Fatal编程技术网

Python 类型错误:';元组';对象在pygame中不可调用

Python 类型错误:';元组';对象在pygame中不可调用,python,pygame,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: 'tupl

当我运行此代码时:

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
文件“index.py”,第62行,在
myFunction()
drawGamesToScreen中第55行的文件“index.py”
表面处理中心(400,ipnum*100)
TypeError:“tuple”对象不可调用

center
Rect
实例上返回一个元组,因此不能在此处使用
.center(x,y)
。只需指定一个新元组,如下所示:

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

我猜您希望在矩形元组之外的其他对象上运行
.center()
。也许在
surfacefort
?看起来它不是中心而是元组属性,而不是函数。它返回错误:AttributeError:“pygame.Surface”对象没有属性“center”