繁体   English   中英

TypeError:PyGame中不能调用'tuple'对象

[英]Typeerror: 'tuple' object is not callable in 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

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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM