【问题标题】:Pygame error: 'int' object is not callablePygame 错误:'int' 对象不可调用
【发布时间】:2021-04-30 14:05:52
【问题描述】:
import pygame

pygame.init()
screen = pygame.display.set_mode((800, 600))
running = True
while running:
    for event in pygame.event.get():
        if event.type == pygame.QUIT(): 
            running = False

执行此代码时,出现以下错误:

'int' object is not callable

【问题讨论】:

  • 也许可以尝试查看错误,尤其是说错误在哪一列

标签: python pygame typeerror


【解决方案1】:

pygame.QUITint 而不是函数。尝试删除括号:

if event.type == pygame.QUIT:
    running = False

【讨论】:

    猜你喜欢
    • 2013-04-03
    • 2023-03-03
    • 2013-02-20
    • 2016-06-19
    • 1970-01-01
    • 2018-04-24
    • 2020-06-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多