首页 > 代码库 > pygame学习之绘制圆

pygame学习之绘制圆

 1 import pygame
 2 from pygame.locals import *
 3 
 4 pygame.init()
 5 screen = pygame.display.set_mode((600, 500))
 6 pygame.display.set_caption("drawing a circle")
 7 while True:
 8     for event in pygame.event.get():
 9         if event.type in (QUIT, KEYDOWN):
10             exit()
11     screen.fill((0, 0, 200))
12     color = 255, 255, 0
13     position = 300, 250
14     radius = 100                 # 圆的半径
15     width = 10
16     pygame.draw.circle(screen, color, position, radius, width)
17     pygame.display.update()

 

pygame学习之绘制圆