#-*-coding:utf-8-*-
import pygame
from pygame.locals import *
from sys import exit
#thcolors 用于加载颜色进来
from pygame.color import THECOLORS
import time
pygame.init()
screen = pygame.display.set_mode((700, 480), 0, 32)
pygame.display.set_caption((r'python 画图工具').encode('utf-8')) 
start=time.clock ()
while True:
    for event in pygame.event.get():
        if event.type == QUIT:
            exit()
    end=time.clock ()
    if  int(end-start)==60:
        break
    screen.fill((255,255,255))
    #画矩形
    pygame.draw.rect(screen,[255,0,0],[400,280,300,200],1)
    pygame.draw.rect(screen,[255,0,0],[0,0,300,200],1)
    pygame.draw.rect(screen,[255,0,0],[0,280,300,200],1)
    pygame.draw.rect(screen,[255,0,0],[300,200,100,80],1)
    pygame.draw.rect(screen,[255,0,0],[400,0,300,200],1)
    #画多边形
    pygame.draw.polygon(screen,THECOLORS["red1"],[(100,100),(100,200),(300,100),(300,200)],1)
    #画圆
    pygame.draw.circle(screen,THECOLORS["red1"],[350,240],50,45)
    #画椭圆
    pygame.draw.ellipse(screen, THECOLORS["red1"], [250,200,200,80],0)
    #画弧线 
    pygame.draw.arc(screen, (0,255,0), (200, 200, 200, 100), 3.14159/3, 3.14159*2/3)
    x, y = pygame.mouse.get_pos()
    #画直线
    pygame.draw.line(screen, (0, 0, 255), (0, 0), (x, y))
    #画多条直线
    pygame.draw.lines(screen, (0,0,255), False,[(300,200),(300,500)],0) 
    #以下为根据鼠标画椭圆,矩形,圆
    pygame.draw.ellipse(screen, THECOLORS["blue"], [0,0,x,y],0)
    pygame.draw.rect(screen,[255,0,0],[100,100,x,y],0)
    pygame.draw.circle(screen,THECOLORS["red1"],[100,100],x,y)

   
    pygame.display.update()