#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
#  poligono.py
#  
#  Copyright 2017 luca <luca@luca-Ubunru16>
#  
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#  
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#  
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
#  MA 02110-1301, USA.
#  
#  
import turtle

risposta=input("quanti poligoni vuoi disegnare? (max 10): ")
npoligoni=int(risposta)
if (npoligoni < 0 or npoligoni > 10):
        print("input non valido : %s" %risposta)
        quit()
        
t=turtle.Pen()
turtle.screensize(600,600)
t.penup()
t.setpos(-280,270)
t.write("poligoni", move=False, align="left", font=("Arial", 16, "normal"))
turtle.delay(20)

colori = ["red","green","orange","blue","lightblue","violet","brown","pink","magenta","darkgreen"]
lato = 150
nlati = 3        
t.setpos((-100,-250))
turtle.title("poligoni")
t.pendown()
t.speed('slow')
for j in range (npoligoni):
        t.pen(pensize=3, pencolor=colori[j])
        for n in range(nlati):
                t.fd(lato)
                t.left(360/nlati)
        nlati=nlati+1
t.penup()	
t.setpos(-150,-290)
t.write("fai click per uscire", move=False, align="left", font=("Arial", 18, "normal"))
turtle.exitonclick()
	
