python - Pygame 错误:'int' 对象不可调用
问题描述
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
解决方案
pygame.QUIT
是一个int
而不是一个函数。尝试删除括号:
if event.type == pygame.QUIT:
running = False
推荐阅读
- javascript - 如何编译嵌套层次结构中的所有后代
- python - python - 如何将列中的数据拆分为Python中的一些单独的列?
- javascript - 在刷新页面 MVC 上丢失的 JavaScript 中动态创建的内容
- jenkins - Jenkins Kubernetes、podTemplates 和 inheritFrom
- python - 在 python 类之外创建具有类自身变量的方法,然后将其作为方法添加到类中
- python - API中的Python for循环以获取数据?
- r - In R plotly, when i using'frame' function, is there any way can set y-axis 'free-y'?
- javascript - Discord.js v12+ Changing channel name error
- regex - 如何为可以有 2 个可能的周围字符的数字实现单个捕获组?
- sql - 我不知道为什么我得到这个“文字与格式字符串不匹配”,有人可以告诉我吗?