import turtle
import tkSimpleDialog
turtle.speed(1)
turtle.pensize(2)
fondo=tkSimpleDialog.askstring("Ingresar color","Escribe el color del fondo:")
lapiz=tkSimpleDialog.askstring("Ingresar color","Escribe el color del lapiz:")
relleno=tkSimpleDialog.askstring("Ingresar color","Escribe el color del relleno:")
turtle.bgcolor(fondo)
turtle.color(lapiz,relleno)
turtle.begin_fill()
for i in range(3):
turtle.forward(150)
turtle.left(120)
turtle.end_fill()
turtle.done()
2. Hexágono
import turtle
import tkSimpleDialog
turtle.speed(1)
turtle.pensize(2)
fondo=tkSimpleDialog.askstring("Ingresar color","Escribe el color del fondo:")
lapiz=tkSimpleDialog.askstring("Ingresar color","Escribe el color del lapiz:")
relleno=tkSimpleDialog.askstring("Ingresar color","Escribe el color del relleno:")
turtle.bgcolor(fondo)
turtle.color(lapiz,relleno)
turtle.begin_fill()
for i in range(6):
turtle.forward(100)
turtle.left(60)
turtle.end_fill()
turtle.done()
3. Octágono
import turtle
import tkSimpleDialog
turtle.speed(1)
turtle.pensize(2)
fondo=tkSimpleDialog.askstring("Ingresar color","Escribe el color del fondo:")
lapiz=tkSimpleDialog.askstring("Ingresar color","Escribe el color del lapiz:")
relleno=tkSimpleDialog.askstring("Ingresar color","Escribe el color del relleno:")
turtle.bgcolor(fondo)
turtle.color(lapiz,relleno)
turtle.begin_fill()
for i in range(8):
turtle.forward(100)
turtle.left(45)
turtle.end_fill()
turtle.done()
No hay comentarios:
Publicar un comentario