我只是在 pygame 中进行一些开发,但遇到了一些非常奇怪的麻烦。这是我的代码:
import pygame, sys
from pygame.locals import *
#Declarin some variables
WINHEIGHT = 320
WINWIDTH = 640
red = (255, 0, 0)
pygame.init()
DISPLAY = pygame.display.set_mode((WINWIDTH, WINHEIGHT))
pygame.display.set_caption('My First PyGame')
FONT = pygame.font.Font(None, 32)
while True:
pygame.draw.circle(DISPLAY, red, (100, 100)
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
我在第 18 行收到无效语法错误,说明了这一点
for event in pygame.event.get():
^
是否存在语法错误,即使不是,请帮忙?
最佳答案
注意上面的行:
pygame.draw.circle(DISPLAY, red, (100, 100)
你缺少一个括号:
pygame.draw.circle(DISPLAY, red, (100, 100))
关于python - Pygame 游戏循环语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14167490/