import pygame from pygame.locals import * import sys import math class Game: def __init__(self): pygame.init() self.W,self.H=800,800 self.screen=pygame.display.set_mode((self.W,self.H)) pygame.display.set_caption("【Pygame 学习笔记】") def listen(self): for event in pygame.event.get(): if event.type==QUIT: sys.exit() def draw(self): self.screen.fill((255,255,255)) # pygame.draw.rect(self.screen,(255,0,0),(100,100,300,300)) # pygame.draw.circle(self.screen,(0,255,0),(400,400),30) # pygame.draw.line(self.screen,(0,0,255),(300,400),(500,600)) # pygame.draw.lines(self.screen,(0,0,0),True,[(300,500),(500,700),(700,500)]) pygame.draw.arc(self.screen,(0,0,255),(100,100,200,200),math.radians(0),math.radians(45)) def run(self): while True: self.listen() self.draw() pygame.display.update() if __name__ == '__main__': game=Game() game.run()