我只是在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():
^
语法错误,即使它不是,帮助?
答案 0 :(得分:3)
请注意以上一行:
pygame.draw.circle(DISPLAY, red, (100, 100)
您缺少一个括号:
pygame.draw.circle(DISPLAY, red, (100, 100))
答案 1 :(得分:1)
你错过了)
就这么说吧
(pygame.draw.circle(DISPLAY, red, (100, 100) # here!