import turtle
import tkSimpleDialog
t = turtle.Turtle()
c1=tkSimpleDialog.askstring(" Color","Contorno")
c2=tkSimpleDialog.askstring("Relleno","Color de figura")
pen_color = c1
fill_color = c2
t.color(c1,c2)
t.begin_fill()
for _ in range(4):
t.fd(100)
t.left(90)
t.end_fill()
turtle.exitonclick()
Triangulo
import turtle import tkSimpleDialog t = turtle.Turtle() c1=tkSimpleDialog.askstring(" Color","Contorno") c2=tkSimpleDialog.askstring("Relleno","Color de figura") pen_color = c1 fill_color = c2 t.color(c1,c2) t.begin_fill() for _ in range(3): t.fd(100) t.left(120) t.end_fill() turtle.exitonclick()
Octágono
import turtle import tkSimpleDialog t = turtle.Turtle() c1=tkSimpleDialog.askstring(" Color","Contorno") c2=tkSimpleDialog.askstring("Relleno","Color de figura") pen_color = c1 fill_color = c2 t.color(c1,c2) t.begin_fill() for _ in range(8): t.fd(100) t.left(45) t.end_fill() turtle.exitonclick()
No hay comentarios.:
Publicar un comentario