当我运行此代码时:
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
最佳答案
center
实例上的Rect
返回一个元组,因此您不能在此处使用.center(x,y)
。只需分配一个新的元组,如下所示:
SURFACER.center = (400, (ipnum*100))
关于python - TypeError:在pygame中无法调用'tuple'对象,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/44387706/