簡體   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