[英]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.