Capturas:
Código:
Triangulo
import turtle import tkSimpleDialog turtle.speed(100) fonde = turtle.Screen() b=tkSimpleDialog.askstring("hola","Dame el color") c=tkSimpleDialog.askstring("hola","Dame el color del fondo") a=tkSimpleDialog.askstring("hola","Dame el color del relleno") fonde.bgcolor(c) turtle.pencolor(b) turtle.fillcolor(a) turtle.begin_fill() for x in range (3): turtle.forward(100) turtle.left(120) turtle.end_fill() turtle.exitonclick()
Cuadrado
import turtle import tkSimpleDialog turtle.speed(100) fonde = turtle.Screen() b=tkSimpleDialog.askstring("hola","Dame el color") c=tkSimpleDialog.askstring("hola","Dame el color del fondo") a=tkSimpleDialog.askstring("hola","Dame el color del relleno") fonde.bgcolor(c) turtle.pencolor(b) turtle.fillcolor(a) turtle.begin_fill() for x in range (4): turtle.forward(100) turtle.left(90) turtle.end_fill() turtle.exitonclick()
Octagono
import turtle import tkSimpleDialog turtle.speed(100) fonde = turtle.Screen() b=tkSimpleDialog.askstring("hola","Dame el color") c=tkSimpleDialog.askstring("hola","Dame el color del fondo") a=tkSimpleDialog.askstring("hola","Dame el color del relleno") fonde.bgcolor(c) turtle.pencolor(b) turtle.fillcolor(a) turtle.begin_fill() for x in range (8): turtle.forward(100) turtle.left(45) turtle.end_fill() turtle.exitonclick()
No hay comentarios:
Publicar un comentario