问题描述
我一直在寻找文档,YouTube上的许多视频,关于stackoverflow的问题,但仍然无法解决。这是我的代码:
import pygame
pygame.init()
run = True
#color def
BK = (0,0)
WT = (255,255,255)
GY = (127,127,127)
#create screen
screen = pygame.display.set_mode((800,600))
#title,icon
pygame.display.set_caption("Clock")
icon = pygame.image.load("clock.png")
pygame.display.set_icon(icon)
#loop
while run:
for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False
pygame.draw.circle(screen,WT,(0,0),175,width=1)
解决方法
您错过了通过pygame.display.update()
或pygame.display.flip()
来更新显示的信息。并且您需要在应用程序循环中绘制圆圈。关心Indentation:
while run:
for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False
#-->| INDENTATION
# clear display
screen.fill(0)
# draw scene (circle)
pygame.draw.circle(screen,WT,(0,0),175,width=1)
# update display
pygame.display.flip()