text: """Paint, for drawing shpes.
  
  Exercises
  
  1. Add a color.
  2. Complete circle.
  3. Complete rectangle.
  4. Complete triangle.
  5. Add width parameter.
  Authors: 
  Circle
  Samuel Acevedo
  ITC
  2do Semestre
  David Vieyra
  ITC
  2do Semestre
  Aarón Castillo
  ITD
  6to Semestre
  =======
  Gilberto Echeverria
  main
  
  """
  
  import math
  from math import *
  from math import hypot
  from turtle import *
  import turtle 
  from freegames import vector
  
  def line(start, end):
      "Draw line from start to end."
      up()
      goto(start.x, start.y)
      down()
      goto(end.x, end.y)
  
  def square(start, end):
      "Draw square from start to end."
      up()
      goto(start.x, start.y)
      down()
      begin_fill()
  
      for count in range(4):
          forward(end.x - start.x)
          left(90)
  
      end_fill()
  
  def circle2(start, end):
      "Draw circle from start to end."
      radius = math.sqrt((end.x - start.x)**2 + (end.y - start.y)**2)
      up()
      goto(start.x, start.y - radius)
      down()
      begin_fill()
      circle(radius)
      end_fill()
  
  def rectangle(start, end):
      "Draw rectangle from start to end."
      up()
      goto(start.x, start.y)
      down()
      begin_fill()
  
      for count in range(2):
          forward(end.x - start.x)
          right(90)
          forward((end.x - start.x)*0.5)
          right(90)
      end_fill()
  
  def triangle(start, end):
      "Draw triangle from start to end."
      tur = turtle.Turtle()
   
      tur.forward(100)  
      tur.left(120)
      tur.forward(100)
      
      tur.left(120)
      tur.forward(100)
      
      turtle.done()
  
  
  def tap(x, y):
      "Store starting point or draw shape."
      start = state['start']
  
      if start is None:
          state['start'] = vector(x, y)
      else:
          shape = state['shape']
          end = vector(x, y)
          shape(start, end)
          state['start'] = None
  
  def store(key, value):
      "Store value in state at key."
      state[key] = value
  
  state = {'start': None, 'shape': line}
  setup(420, 420, 370, 0)
  onscreenclick(tap)
  listen()
  onkey(undo, 'u')
  onkey(lambda: color('black'), 'K')
  onkey(lambda: color('cyan'), 'C')
  onkey(lambda: color('white'), 'W')
  onkey(lambda: color('green'), 'G')
  onkey(lambda: color('blue'), 'B')
  onkey(lambda: color('red'), 'R')
  onkey(lambda: color('orange'), 'O')
  onkey(lambda: color('purple'), 'P')
  onkey(lambda: store('shape', line), 'l')
  onkey(lambda: store('shape', square), 's')
  onkey(lambda: store('shape', circle2), 'c')
  onkey(lambda: store('shape', rectangle), 'r')
  onkey(lambda: store('shape', triangle), 't')
  done()
  