lunes, 30 de octubre de 2017
Progarama de figuras con Turtle
# -*- coding: utf-8 -*-
from Tkinter import *
import turtle
import tkSimpleDialog
from tkColorChooser import askcolor
import math
ventanaPrincipal = Tk()
ventanaPrincipal.resizable(False, False)
ventanaPrincipal.title("Ventana principal - Area de dibujo")
canvasLienzo = Canvas(ventanaPrincipal, width=750, height=750)
canvasLienzo.pack(side="left", fill="both", expand=True)
canvasMenu = Canvas(ventanaPrincipal, width=750, height=750)
canvasMenu.pack(side="right", fill="both", expand=True)
turtle_screen = turtle.TurtleScreen(canvasLienzo)
turtle_screen.bgcolor("white")
tortuga=turtle.RawTurtle(turtle_screen)
lapizColor = "black"
rellenoColor = "white"
tortuga.fill(False)
fondoColor = "white"
posicionX=DoubleVar()
posicionY=DoubleVar()
def limpiar():
tortuga.reset()
colorLapiz(botonLapiz,"black")
colorRelleno(botonRelleno,"white")
colorFondo(botonFondo,"white")
def colorLapiz(self,color):
self.configure(bg = color)
tortuga.pencolor(color)
def colorRelleno(self,color):
self.configure(bg=color)
tortuga.fill(True)
print tortuga.fill()
tortuga.fillcolor(color)
def colorFondo(self,color):
self.configure(bg=color)
turtle_screen.bgcolor(color)
def seleccionarColor():
seleccion = askcolor()
return seleccion[1]
def tamanioLapiz(event):
w=event.widget
if isinstance(w,Scale):
tortuga.pensize(w.get())
def cambiarCoordenadas():
try:
posicionX.set(tkSimpleDialog.askfloat("Posición en X", "Ingresa la coordenada: ", initialvalue=0.0))
posicionY.set(tkSimpleDialog.askfloat("Posición en Y", "Ingresa la coordenada: ", initialvalue=0.0))
tortuga.penup()
tortuga.goto(posicionX.get(),posicionY.get())
tortuga.pendown()
except:
print "Operación cancelada"
def poligono():
try:
lados = tkSimpleDialog.askinteger("Poligono regular", "Ingresa el número de lados: ",initialvalue=3,minvalue=3,maxvalue=360)
linea = tkSimpleDialog.askinteger("Poligono regular", "Ingresa el tamaño de cada lado: ", initialvalue=50,minvalue=1)
angulo = DoubleVar()
angulo.set(360.0/lados)
print tortuga.fill()
if(tortuga.fill()==True):
tortuga.begin_fill()
for i in range(lados):
tortuga.forward(linea)
tortuga.left(angulo.get())
tortuga.end_fill()
colorRelleno(botonRelleno,"white")
tortuga.fill(False)
except:
print "Operacion cancelada"
def mariposa():
n = 0
colores = ["#201815", "#584C4C", "#3F6E80", "#0F4851", "#473A68", "#201815", "#584C4C", "#3F6E80", "#0F4851",
"#473A68"]
if (tortuga.fill() == True):
tortuga.begin_fill()
for t in range(0, 3600):
if (t % 360 == 0):
tortuga.pencolor(colores[n])
colorLapiz(botonLapiz, colores[n])
n = n + 1
t = t * ((math.pi) / 180)
x = (math.sin(t) * ((math.exp(math.cos(t))) - (2 * math.cos(4 * t)) - ((math.sin(t / 12)) ** 5))) * 60
y = (math.cos(t) * ((math.exp(math.cos(t))) - (2 * math.cos(4 * t)) - ((math.sin(t / 12)) ** 5))) * 60
tortuga.goto(x, y)
tortuga.end_fill()
def repetirPoligonos():
try:
lados = tkSimpleDialog.askinteger("Poligono regular", "Ingresa el número de lados: ",initialvalue=3,minvalue=3,maxvalue=360)
linea = tkSimpleDialog.askinteger("Poligono regular", "Ingresa el tamaño de cada lado: ", initialvalue=50,minvalue=1)
repeticion = tkSimpleDialog.askinteger("Poligono regular", "Ingresa el número de repeticiones: ", initialvalue=1,minvalue=1, maxvalue=100)
angulo = tkSimpleDialog.askinteger("Poligono regular", "Ingresa el ángulo de rotación: ",initialvalue=1, minvalue=1, maxvalue=360)
anguloFigura = DoubleVar()
anguloFigura.set(360.0/lados)
print tortuga.fill()
if (tortuga.fill() == True):
tortuga.begin_fill()
for i in range(repeticion):
tortuga.left(angulo)
for j in range(lados):
tortuga.forward(linea)
tortuga.left(anguloFigura.get())
tortuga.end_fill()
colorRelleno(botonRelleno,"white")
tortuga.fill(False)
except:
print "Operacion cancelada"
def espiral():
tam=25
tortuga.speed(20)
for i in range(120):
tortuga.left(5)
for j in range(4):
tortuga.forward(tam)
tortuga.left(90)
tam=tam+5
def origen():
tortuga.penup()
tortuga.home()
tortuga.pendown()
def globo():
aumento = 0
aumento2=0
color = ["#c1133d", "#e2e2e2", "#842a40"]
for i in range(3):
tortuga.penup()
tortuga.home()
tortuga.pendown()
colorRelleno(botonRelleno,color[i])
tortuga.fillcolor(color[i])
tortuga.begin_fill()
tortuga.forward(30 - aumento)
tortuga.left(50 + aumento)
tortuga.forward(120)
tortuga.left(5)
tortuga.forward(30)
tortuga.left(5)
tortuga.forward(30)
tortuga.left(5)
tortuga.forward(30)
if (i == 2):
tortuga.left(2)
tortuga.forward(15)
tortuga.left(2)
tortuga.forward(15)
tortuga.left(2)
tortuga.forward(15)
tortuga.left(3)
tortuga.forward(10)
tortuga.left(3)
tortuga.forward(10)
tortuga.left(3)
tortuga.forward(10)
tortuga.left(3)
tortuga.forward(10)
tortuga.left(3)
tortuga.forward(10)
tortuga.left(3)
tortuga.forward(10)
tortuga.left(4)
tortuga.forward(10)
tortuga.left(4)
tortuga.forward(10)
tortuga.left(5)
tortuga.forward(10)
tortuga.left(5)
tortuga.forward(10)
tortuga.left(5)
tortuga.forward(10)
tortuga.left(5)
tortuga.forward(10)
tortuga.left(5)
tortuga.forward(15)
tortuga.left(5)
tortuga.forward(15)
tortuga.home()
tortuga.end_fill()
if (i == 1):
tortuga.left(10)
tortuga.forward(30)
tortuga.left(10)
tortuga.forward(30)
tortuga.left(10)
tortuga.forward(30)
tortuga.left(10)
tortuga.forward(30)
tortuga.left(15)
tortuga.forward(15)
tortuga.left(3)
tortuga.forward(10)
tortuga.left(3)
tortuga.forward(10)
tortuga.left(3)
tortuga.forward(10)
tortuga.left(3)
tortuga.forward(10)
tortuga.left(3)
tortuga.forward(10)
tortuga.left(3)
tortuga.forward(10)
tortuga.left(3)
tortuga.forward(10)
tortuga.left(3)
tortuga.forward(10)
tortuga.left(2)
tortuga.forward(10)
tortuga.left(2)
tortuga.forward(12)
tortuga.home()
tortuga.end_fill()
if (i == 0):
tortuga.left(10)
tortuga.forward(30)
tortuga.left(10)
tortuga.forward(30)
tortuga.left(10)
tortuga.forward(30)
tortuga.left(10)
tortuga.forward(30)
tortuga.left(15)
tortuga.forward(15)
tortuga.left(5)
tortuga.forward(10)
tortuga.left(5)
tortuga.forward(10)
tortuga.left(5)
tortuga.forward(15)
tortuga.left(5)
tortuga.forward(15)
tortuga.left(5)
tortuga.forward(15)
tortuga.left(5)
tortuga.forward(15)
tortuga.left(5)
tortuga.forward(15)
tortuga.left(5)
tortuga.forward(15)
tortuga.left(5)
tortuga.forward(15)
tortuga.left(5)
tortuga.forward(15)
tortuga.left(5)
tortuga.forward(15)
tortuga.left(5)
tortuga.forward(15)
tortuga.end_fill()
aumento += 10
for i in range(3):
tortuga.penup()
tortuga.home()
tortuga.pendown()
colorRelleno(botonRelleno, color[2 - i])
tortuga.fillcolor(color[2 - i])
tortuga.begin_fill()
tortuga.left(180)
tortuga.forward(30 - aumento2)
tortuga.right(50 + aumento2)
tortuga.forward(120)
tortuga.right(5)
tortuga.forward(30)
tortuga.right(5)
tortuga.forward(30)
tortuga.right(5)
tortuga.forward(30)
if (i == 2):
tortuga.right(2)
tortuga.forward(15)
tortuga.right(2)
tortuga.forward(15)
tortuga.right(2)
tortuga.forward(15)
tortuga.right(3)
tortuga.forward(10)
tortuga.right(3)
tortuga.forward(10)
tortuga.right(3)
tortuga.forward(10)
tortuga.right(3)
tortuga.forward(10)
tortuga.right(3)
tortuga.forward(10)
tortuga.right(3)
tortuga.forward(10)
tortuga.right(4)
tortuga.forward(10)
tortuga.right(4)
tortuga.forward(10)
tortuga.right(5)
tortuga.forward(10)
tortuga.right(5)
tortuga.forward(10)
tortuga.right(5)
tortuga.forward(10)
tortuga.right(5)
tortuga.forward(10)
tortuga.right(5)
tortuga.forward(15)
tortuga.right(5)
tortuga.forward(15)
tortuga.end_fill()
if (i == 1):
tortuga.right(10)
tortuga.forward(30)
tortuga.right(10)
tortuga.forward(30)
tortuga.right(10)
tortuga.forward(30)
tortuga.right(10)
tortuga.forward(30)
tortuga.right(15)
tortuga.forward(14)
tortuga.right(3)
tortuga.forward(10)
tortuga.right(3)
tortuga.forward(10)
tortuga.right(3)
tortuga.forward(10)
tortuga.right(3)
tortuga.forward(10)
tortuga.right(3)
tortuga.forward(10)
tortuga.right(3)
tortuga.forward(10)
tortuga.right(3)
tortuga.forward(10)
tortuga.right(3)
tortuga.forward(10)
tortuga.right(2)
tortuga.forward(10)
tortuga.right(2)
tortuga.forward(12)
tortuga.end_fill()
if (i == 0):
tortuga.right(10)
tortuga.forward(30)
tortuga.right(10)
tortuga.forward(30)
tortuga.right(10)
tortuga.forward(30)
tortuga.right(10)
tortuga.forward(30)
tortuga.right(15)
tortuga.forward(14)
tortuga.right(5)
tortuga.forward(10)
tortuga.right(5)
tortuga.forward(10)
tortuga.right(5)
tortuga.forward(15)
tortuga.right(5)
tortuga.forward(15)
tortuga.right(5)
tortuga.forward(15)
tortuga.right(5)
tortuga.forward(15)
tortuga.right(5)
tortuga.forward(15)
tortuga.right(5)
tortuga.forward(15)
tortuga.right(5)
tortuga.forward(15)
tortuga.right(5)
tortuga.forward(15)
tortuga.right(5)
tortuga.forward(15)
tortuga.right(5)
tortuga.forward(15)
tortuga.end_fill()
aumento2 += 10
origen()
tortuga.goto(2, 373)
origen()
colorRelleno(botonRelleno, "#A05150")
tortuga.fillcolor("#A05150")
tortuga.begin_fill()
tortuga.forward(30)
tortuga.right(120)
tortuga.forward(15)
tortuga.right(60)
tortuga.forward(46)
tortuga.right(60)
tortuga.forward(15)
tortuga.home()
tortuga.end_fill()
tortuga.penup()
tortuga.goto(16, -12)
tortuga.pensize(3)
tortuga.pendown()
tortuga.right(90)
tortuga.forward(20)
tortuga.left(160)
tortuga.forward(20)
origen()
tortuga.penup()
tortuga.goto(-15, -12)
tortuga.pendown()
tortuga.right(90)
tortuga.forward(20)
tortuga.right(155)
tortuga.forward(20)
origen()
tortuga.penup()
tortuga.goto(0, -32)
tortuga.pendown()
colorLapiz(botonLapiz, "#C96B46")
tortuga.pencolor("#C96B46")
tortuga.pensize(4)
tortuga.forward(15)
tortuga.right(65)
tortuga.forward(30)
origen()
tortuga.penup()
tortuga.goto(0, -32)
tortuga.pendown()
tortuga.right(180)
tortuga.forward(15)
tortuga.left(65)
tortuga.forward(30)
origen()
tortuga.penup()
tortuga.goto(0, -60)
tortuga.pendown()
colorLapiz(botonLapiz, "#000000")
tortuga.pencolor("#000000")
colorRelleno(botonRelleno, "#A05150")
tortuga.fillcolor("#A05150")
tortuga.begin_fill()
tortuga.pensize(2)
tortuga.forward(35)
tortuga.right(90)
tortuga.forward(6)
tortuga.right(90)
tortuga.forward(70)
tortuga.right(90)
tortuga.forward(6)
tortuga.right(90)
tortuga.forward(35)
tortuga.end_fill()
tortuga.penup()
tortuga.right(90)
tortuga.forward(6)
tortuga.pendown()
colorRelleno(botonRelleno, "#8D3E35")
tortuga.fillcolor("#8D3E35")
tortuga.begin_fill()
tortuga.left(90)
tortuga.forward(33)
tortuga.right(110)
tortuga.forward(30)
tortuga.right(70)
tortuga.forward(45)
tortuga.right(70)
tortuga.forward(30)
tortuga.right(110)
tortuga.forward(33)
tortuga.end_fill()
etiquetaT1 = Label(canvasMenu, text="Opciones", justify=CENTER, font="Arial 12")
etiquetaT1.grid(row=1, column=1,columnspan=2)
etiquetaT1 = Label(canvasMenu, text="Lápiz:", font="Arial 10", pady=5)
etiquetaT1.grid(row=2, column=1)
botonLapiz = Button(canvasMenu, bg=lapizColor, command=lambda: colorLapiz(botonLapiz, seleccionarColor()))
botonLapiz.grid(row=2, column=2, sticky="W,E")
etiquetaT2 = Label(canvasMenu, text="Relleno:", font="Arial 10", pady=5)
etiquetaT2.grid(row=3, column=1)
botonRelleno = Button(canvasMenu, bg=rellenoColor, command=lambda: colorRelleno(botonRelleno, seleccionarColor()))
botonRelleno.grid(row=3, column=2, sticky="W,E")
etiquetaT3 = Label(canvasMenu, text="Fondo:", font="Arial 10", pady=5)
etiquetaT3.grid(row=4, column=1)
botonFondo = Button(canvasMenu, bg=fondoColor, command=lambda: colorFondo(botonFondo, seleccionarColor()))
botonFondo.grid(row=4, column=2, sticky="W,E")
etiquetaT4 = Label(canvasMenu, text="Tamaño del lápiz", font="Arial 10", pady=5)
etiquetaT4.grid(row=5, column=1,columnspan=2)
botonEscala = Scale(canvasMenu, orient=HORIZONTAL, from_=1, to=10)
botonEscala.grid(row=6, column=1, sticky="W,E",columnspan=2)
botonEscala.bind('',tamanioLapiz)
botonPoligonos = Button(canvasMenu,text="Poligono regular",command=lambda: poligono())
botonPoligonos.grid(row=7, column=1, sticky="W,E", columnspan=2)
botonRepetir = Button(canvasMenu, text="Repetir Poligonos",command=lambda:repetirPoligonos())
botonRepetir.grid(row=8, column=1, sticky="W,E", columnspan=2)
botonMover = Button(canvasMenu, text="Cambiar coordenadas", command=lambda: cambiarCoordenadas())
botonMover.grid(row=9, column=1, sticky="W,E", columnspan=2,pady=10)
botonGlobo = Button(canvasMenu, text="Dibujo globo", command=lambda: globo())
botonGlobo.grid(row=10, column=1, sticky="W,E", columnspan=2)
botonMariposa = Button(canvasMenu, text="Mariposa", command=lambda: mariposa())
botonMariposa.grid(row=11, column=1, sticky="W,E", columnspan=2)
botonMariposa = Button(canvasMenu, text="Espiral", command=lambda: espiral())
botonMariposa.grid(row=12, column=1, sticky="W,E", columnspan=2)
botonLimpiar = Button(canvasMenu, text="Limpiar lienzo", command=lambda: limpiar())
botonLimpiar.grid(row=19, column=1, sticky="W,E", columnspan=2,pady=10)
mainloop()
jueves, 19 de octubre de 2017
Figura propia con turtle
import turtle
n = turtle.Turtle()
turtle.setup(800, 800, 0, 0)
turtle.screensize(750,750)
turtle.bgcolor("#7FBFB1")
n.pensize(2)
n.speed(10)
aumento=0
aumento2=0
color=["#c1133d","#e2e2e2","#842a40"]
def origen():
n.penup()
n.home()
n.pendown()
for i in range(3):
n.penup()
n.home()
n.pendown()
n.fillcolor(color[i])
n.begin_fill()
n.forward(30 - aumento)
n.left(50 + aumento)
n.forward(120)
n.left(5)
n.forward(30)
n.left(5)
n.forward(30)
n.left(5)
n.forward(30)
if(i==2):
n.left(2)
n.forward(15)
n.left(2)
n.forward(15)
n.left(2)
n.forward(15)
n.left(3)
n.forward(10)
n.left(3)
n.forward(10)
n.left(3)
n.forward(10)
n.left(3)
n.forward(10)
n.left(3)
n.forward(10)
n.left(3)
n.forward(10)
n.left(4)
n.forward(10)
n.left(4)
n.forward(10)
n.left(5)
n.forward(10)
n.left(5)
n.forward(10)
n.left(5)
n.forward(10)
n.left(5)
n.forward(10)
n.left(5)
n.forward(15)
n.left(5)
n.forward(15)
n.home()
n.end_fill()
if(i==1):
n.left(10)
n.forward(30)
n.left(10)
n.forward(30)
n.left(10)
n.forward(30)
n.left(10)
n.forward(30)
n.left(15)
n.forward(15)
n.left(3)
n.forward(10)
n.left(3)
n.forward(10)
n.left(3)
n.forward(10)
n.left(3)
n.forward(10)
n.left(3)
n.forward(10)
n.left(3)
n.forward(10)
n.left(3)
n.forward(10)
n.left(3)
n.forward(10)
n.left(2)
n.forward(10)
n.left(2)
n.forward(12)
n.home()
n.end_fill()
if(i==0):
n.left(10)
n.forward(30)
n.left(10)
n.forward(30)
n.left(10)
n.forward(30)
n.left(10)
n.forward(30)
n.left(15)
n.forward(15)
n.left(5)
n.forward(10)
n.left(5)
n.forward(10)
n.left(5)
n.forward(15)
n.left(5)
n.forward(15)
n.left(5)
n.forward(15)
n.left(5)
n.forward(15)
n.left(5)
n.forward(15)
n.left(5)
n.forward(15)
n.left(5)
n.forward(15)
n.left(5)
n.forward(15)
n.left(5)
n.forward(15)
n.left(5)
n.forward(15)
n.end_fill()
aumento+=10
for i in range(3):
n.penup()
n.home()
n.pendown()
n.fillcolor(color[2-i])
n.begin_fill()
n.left(180)
n.forward(30 - aumento2)
n.right(50 + aumento2)
n.forward(120)
n.right(5)
n.forward(30)
n.right(5)
n.forward(30)
n.right(5)
n.forward(30)
if (i == 2):
n.right(2)
n.forward(15)
n.right(2)
n.forward(15)
n.right(2)
n.forward(15)
n.right(3)
n.forward(10)
n.right(3)
n.forward(10)
n.right(3)
n.forward(10)
n.right(3)
n.forward(10)
n.right(3)
n.forward(10)
n.right(3)
n.forward(10)
n.right(4)
n.forward(10)
n.right(4)
n.forward(10)
n.right(5)
n.forward(10)
n.right(5)
n.forward(10)
n.right(5)
n.forward(10)
n.right(5)
n.forward(10)
n.right(5)
n.forward(15)
n.right(5)
n.forward(15)
n.end_fill()
if (i == 1):
n.right(10)
n.forward(30)
n.right(10)
n.forward(30)
n.right(10)
n.forward(30)
n.right(10)
n.forward(30)
n.right(15)
n.forward(14)
n.right(3)
n.forward(10)
n.right(3)
n.forward(10)
n.right(3)
n.forward(10)
n.right(3)
n.forward(10)
n.right(3)
n.forward(10)
n.right(3)
n.forward(10)
n.right(3)
n.forward(10)
n.right(3)
n.forward(10)
n.right(2)
n.forward(10)
n.right(2)
n.forward(12)
n.end_fill()
if (i == 0):
n.right(10)
n.forward(30)
n.right(10)
n.forward(30)
n.right(10)
n.forward(30)
n.right(10)
n.forward(30)
n.right(15)
n.forward(14)
n.right(5)
n.forward(10)
n.right(5)
n.forward(10)
n.right(5)
n.forward(15)
n.right(5)
n.forward(15)
n.right(5)
n.forward(15)
n.right(5)
n.forward(15)
n.right(5)
n.forward(15)
n.right(5)
n.forward(15)
n.right(5)
n.forward(15)
n.right(5)
n.forward(15)
n.right(5)
n.forward(15)
n.right(5)
n.forward(15)
n.end_fill()
aumento2 += 10
origen()
n.goto(2,373)
origen()
n.fillcolor("#A05150")
n.begin_fill()
n.forward(30)
n.right(120)
n.forward(15)
n.right(60)
n.forward(46)
n.right(60)
n.forward(15)
n.home()
n.end_fill()
n.penup()
n.goto(16,-12)
n.pensize(3)
n.pendown()
n.right(90)
n.forward(20)
n.left(160)
n.forward(20)
origen()
n.penup()
n.goto(-15,-12)
n.pendown()
n.right(90)
n.forward(20)
n.right(155)
n.forward(20)
origen()
n.penup()
n.goto(0,-32)
n.pendown()
n.pencolor("#C96B46")
n.pensize(4)
n.forward(15)
n.right(65)
n.forward(30)
origen()
n.penup()
n.goto(0,-32)
n.pendown()
n.right(180)
n.forward(15)
n.left(65)
n.forward(30)
origen()
n.penup()
n.goto(0,-60)
n.pendown()
n.pencolor("#000000")
n.fillcolor("#A05150")
n.begin_fill()
n.pensize(2)
n.forward(35)
n.right(90)
n.forward(6)
n.right(90)
n.forward(70)
n.right(90)
n.forward(6)
n.right(90)
n.forward(35)
n.end_fill()
n.penup()
n.right(90)
n.forward(6)
n.pendown()
n.fillcolor("#8D3E35")
n.begin_fill()
n.left(90)
n.forward(33)
n.right(110)
n.forward(30)
n.right(70)
n.forward(45)
n.right(70)
n.forward(30)
n.right(110)
n.forward(33)
n.end_fill()
n.hideturtle()
turtle.done()
miércoles, 18 de octubre de 2017
Figuras con librería Turtle (ventanas de diálogo)
1. Triángulo
2. Hexágono
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(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()
martes, 17 de octubre de 2017
Figuras con turtle utilizando el ciclo for
1. Rectángulo
2. Triángulo
import turtle
turtle.speed(1)
fondo = turtle.Screen()
fondo.bgcolor("yellow")
for i in range(4):
turtle.forward(100)
turtle.right(90)
turtle.done()
import turtle
turtle.speed(1)
fondo = turtle.Screen()
fondo.bgcolor("yellow")
for i in range(4):
turtle.forward(100)
turtle.right(90)
for j in range(1):
turtle.forward(100)
turtle.right(80)
turtle.done()
import turtle
turtle.speed(10)
fondo = turtle.Screen()
fondo.bgcolor("yellow")
for i in range(40):
turtle.forward(100)
turtle.right(90)
for j in range(1):
turtle.forward(100)
turtle.right(80)
turtle.done()
2. Triángulo
import turtle
turtle.speed(1)
fondo = turtle.Screen()
fondo.bgcolor("gray")
turtle.pensize(2)
for i in range(3):
turtle.forward(150)
turtle.left(120)
turtle.done()
import turtle
turtle.speed(10)
fondo = turtle.Screen()
fondo.bgcolor("gray")
turtle.pensize(2)
for i in range(4):
turtle.forward(150)
turtle.left(120)
for i in range(1):
turtle.forward(150)
turtle.left(150)
turtle.done()
import turtle
turtle.speed(10)
fondo = turtle.Screen()
fondo.bgcolor("gray")
turtle.pensize(2)
for i in range(10):
turtle.forward(150)
turtle.left(120)
for i in range(1):
turtle.forward(150)
turtle.left(80)
turtle.done()
import turtle
turtle.speed(10)
fondo = turtle.Screen()
fondo.bgcolor("gray")
turtle.pensize(2)
for i in range(12):
turtle.forward(80)
turtle.left(120)
for i in range(1):
turtle.forward(80)
turtle.right(150)
turtle.done()
sábado, 14 de octubre de 2017
Barquito hecho con la librería turtle
from turtle import *
setup(600,600,0,0)
screensize(400,400)
pensize(3)
pencolor("black")
penup()
goto(200,50)
pendown()
fillcolor("orange")
begin_fill()
goto(100,-50)
goto(-100,-50)
goto(-200,50)
goto(200,50)
end_fill()
penup()
goto(0,50)
pendown()
goto(0,162.5)
goto(100,62.5)
goto(0,62.5)
fillcolor("brown")
begin_fill()
goto(0,175)
goto(-7,175)
goto(-7,50)
goto(0,50)
end_fill()
penup()
fillcolor("blue")
begin_fill()
goto(-300,-50)
pendown()
goto(-300,-150)
goto(300,-150)
goto(300,-50)
goto(-300,-50)
end_fill()
done()
martes, 10 de octubre de 2017
Figuras con la librería Turtle
1. Paloma
2. Canguro
3. Mariposa con Ecuaciones paramétricas
from turtle import *
setup(360, 360, 0, 0)
screensize(330, 330)
title("Figura de Paloma")
pensize(2)
penup()
goto(-32,61)
pendown()
goto(-32,61)
goto(-6,43)
goto(35,12)
goto(58,-4)
goto(89,-13)
goto(91,-22)
goto(79,-28)
goto(103,-46)
goto(32,-20)
goto(16,-17)
goto(-12,-32)
goto(-14,-40)
goto(-3,-44)
goto(-47,-45)
goto(-21,-35)
goto(-15,-25)
goto(-20,-10)
goto(-33,-7)
goto(-63,15)
goto(-69,37)
goto(-63,75)
goto(-69,82)
goto(-82,81)
goto(-65,99)
goto(-48,99)
goto(-42,90)
goto(-32,61)
hideturtle()
done()
2. Canguro
from turtle import *
setup(500, 400, 0, 0)
screensize(400, 350)
title("Figura de Canguro")
pensize(2)
penup()
goto(-30,72)
pendown()
goto(-30,72)
goto(21,79)
goto(26,76)
goto(60,133)
goto(80,137)
goto(66,114)
goto(60,110)
penup()
goto(73,125)
pendown()
goto(73,125)
goto(102,89)
goto(94,78)
goto(62,99)
goto(63,36)
goto(55,2)
goto(57,-16)
goto(39,-3)
goto(24,6)
goto(-4,-17)
goto(-21,-68)
goto(22,-96)
goto(-32,-89)
goto(-39,-73)
goto(-41,-40)
goto(-59,-66)
goto(-237,-17)
goto(-67,-34)
goto(-67,-26)
goto(-30,72)
penup()
goto(13,-4)
pendown()
goto(13,-4)
goto(9,-45)
goto(63,-73)
goto(6,-66)
goto(-7,-49)
goto(-9,-31)
goto(-4,-17)
goto(13,-4)
penup()
goto(79,119)
pendown()
goto(79,119)
goto(84,121)
goto(97,144)
goto(80,137)
goto(73,125)
goto(81,117)
penup()
goto(58,9)
pendown()
goto(58,9)
goto(62,-11)
goto(56,-7)
hideturtle()
done()
3. Mariposa con Ecuaciones paramétricas
from turtle import *
import math
setup(500, 500, 0, 0)
screensize(400, 400)
title("Figura de Mariposa con Ecuaciones parametricas")
colormode(255)
pensize(2)
n=0
colores=["#201815","#584C4C","#3F6E80","#0F4851","#473A68","#201815","#584C4C","#3F6E80","#0F4851","#473A68"]
for t in range(0,3600):
if(t%360==0):
pencolor(colores[n])
n=n+1
t=t*((math.pi)/180)
x = (math.sin(t) * ((math.exp(math.cos(t))) - (2 * math.cos(4*t)) - ((math.sin(t / 12)) ** 5)))*60
y = (math.cos(t) * ((math.exp(math.cos(t))) - (2 * math.cos(4*t)) - ((math.sin(t / 12)) ** 5)))*60
goto(x,y)
hideturtle()
done()
sábado, 7 de octubre de 2017
martes, 3 de octubre de 2017
Práctica polígonos Tkinter con if
# -*- coding: utf-8 -*-
from Tkinter import *
ventanaPrincipal = Tk() # Tk() Es la ventana principal
ventanaPrincipal.title("Ventana principal 2") # Título de la ventana
ventanaPrincipal.config(bg="orange") # Le da color al fondo
ventanaPrincipal.geometry("891x400") # Cambia el tamaño de la ventana
def ejecutar(f):
ventanaPrincipal.after(200, f) # Una forma de ejecutar las funciones
def mostrar(num):
ventanaHija = Toplevel(ventanaPrincipal)
ventanaHija.title("Ventana hija")
ventanaHija.protocol("WM_DELETE_WINDOW", "onexit")
if num == 1:
figura = Canvas(ventanaHija)
figura.config(width=210, height=210,
bg='red') # Lienzo con las medidas y color sobre el que se dibujará la figura
figura.pack(expand=YES, fill=BOTH) # Sirve para cargar la figura
figura.create_oval(10, 10, 200, 200, width=3, fill='blue') # Coordenadas y características de la figura
botonVentanaHija = Button(ventanaHija, text="Cerrar", command=lambda: ejecutar(ventanaHija.destroy()))
botonVentanaHija.pack()
elif num == 2:
figura = Canvas(ventanaHija)
figura.config(width=210, height=210,
bg='white') # Lienzo con las medidas y color sobre el que se dibujará la figura
figura.pack(expand=YES, fill=BOTH) # Sirve para cargar la figura
figura.create_rectangle(10, 10, 200, 200, width=5, fill='yellow') # Coordenadas y características de la figura
botonVentanaHija = Button(ventanaHija, text="Cerrar", command=lambda: ejecutar(ventanaHija.destroy()))
botonVentanaHija.pack()
elif num == 3:
figura = Canvas(ventanaHija)
figura.config(width=210, height=210,
bg='gray') # Lienzo con las medidas y color sobre el que se dibujará la figura
figura.pack(expand=YES, fill=BOTH) # Sirve para cargar la figura
figura.create_line(0, 200, 200, 0, width=10, fill='purple') # Coordenadas y características de la figura
botonVentanaHija = Button(ventanaHija, text="Cerrar", command=lambda: ejecutar(ventanaHija.destroy()))
botonVentanaHija.pack()
elif num == 4:
figura = Canvas(ventanaHija)
figura.config(width=300, height=200,
bg='white') # Lienzo con las medidas y color sobre el que se dibujará la figura
figura.pack(expand=YES, fill=BOTH) # Sirve para cargar la figura
figura.create_arc(10, 10, 190, 190, width=3, start=270, extent=90,
fill='pink') # Coordenadas y características de la figura
botonVentanaHija = Button(ventanaHija, text="Cerrar", command=lambda: ejecutar(ventanaHija.destroy()))
botonVentanaHija.pack()
elif num == 5:
figura = Canvas(ventanaHija)
figura.config(width=300, height=200,
bg='gray') # Lienzo con las medidas y color sobre el que se dibujará la figura
figura.pack(expand=YES, fill=BOTH) # Sirve para cargar la figura
figura.create_arc(10, 10, 190, 190, width=3, start=0, extent=270,
fill='yellow') # Coordenadas y características de la figura
botonVentanaHija = Button(ventanaHija, text="Cerrar", command=lambda: ejecutar(ventanaHija.destroy()))
botonVentanaHija.pack()
elif num == 6:
figura = Canvas(ventanaHija)
figura.config(width=300, height=300,
bg='gray') # Lienzo con las medidas y color sobre el que se dibujará la figura
figura.pack(expand=YES, fill=BOTH) # Sirve para cargar la figura
figura.create_arc(10, 10, 190, 190, width=3, start=0, extent=270,
fill='orange') # Coordenadas y características de la figura
figura.create_arc(20, 20, 200, 200, width=3, start=270, extent=90, fill='brown')
botonVentanaHija = Button(ventanaHija, text="Cerrar", command=lambda: ejecutar(ventanaHija.destroy()))
botonVentanaHija.pack()
elif num == 7:
figura = Canvas(ventanaHija)
figura.config(width=400, height=300,
bg='yellow') # Lienzo con las medidas y color sobre el que se dibujará la figura
figura.pack(expand=YES, fill=BOTH) # Sirve para cargar la figura
figura.create_text(160, 100, fill="purple", font="Times 30 italic bold", text="Texto\n hecho en python.")
botonVentanaHija = Button(ventanaHija, text="Cerrar", command=lambda: ejecutar(ventanaHija.destroy()))
botonVentanaHija.pack()
elif num == 8:
figura = Canvas(ventanaHija)
figura.config(width=400, height=300,
bg='gray') # Lienzo con las medidas y color sobre el que se dibujará la figura
figura.pack(expand=YES, fill=BOTH) # Sirve para cargar la figura
figura.create_polygon(40, 40, 40, 140, 140, 140, 140, 100, fill="orange", outline="brown", width=6)
botonVentanaHija = Button(ventanaHija, text="Cerrar", command=lambda: ejecutar(ventanaHija.destroy()))
botonVentanaHija.pack()
elif num == 9:
figura = Canvas(ventanaHija)
figura.config(width=400, height=300,
bg='white') # Lienzo con las medidas y color sobre el que se dibujará la figura
figura.pack(expand=YES, fill=BOTH) # Sirve para cargar la figura
puntosFigura1 = [40, 40, 40, 200, 60, 200, 60, 80, 100, 160, 140, 80, 140, 200, 160, 200, 160, 40, 140, 40, 100,
120, 60, 40]
figura.create_polygon(puntosFigura1, fill="#006600", outline="black", width=6)
puntosFigura2 = [40, 40, 60, 40, 80, 100, 100, 40, 120, 40, 90, 120, 120, 200, 100, 200, 80, 140, 60, 200, 40,
200, 70, 120]
for i in range(0, len(puntosFigura2)):
if (i % 2 == 0):
puntosFigura2[i] += 140
figura.create_polygon(puntosFigura2, fill="red", outline="black", width=6)
botonVentanaHija = Button(ventanaHija, text="Cerrar", command=lambda: ejecutar(ventanaHija.destroy()))
botonVentanaHija.pack()
elif num == 10:
figura = Canvas(ventanaHija)
figura.config(width=300, height=300, bg='white')
figura.pack(expand=YES, fill=BOTH)
puntosFigura1 = [130, 20,
150, 90,
210, 90,
160, 130,
180, 200,
130, 160,
80, 200,
100, 130,
50, 90,
110, 90]
for i in range(0, len(puntosFigura1)):
puntosFigura1[i] += 30
figura.create_polygon(puntosFigura1, fill="yellow", outline="black", width=4)
botonVentanaHija = Button(ventanaHija, text="Cerrar (David Maldonado)", command=lambda: ejecutar(ventanaHija.destroy()))
botonVentanaHija.pack()
elif num == 11:
figura = Canvas(ventanaHija)
figura.config(width=500, height=300, bg='white')
figura.pack(expand=YES, fill=BOTH)
figura.create_polygon(420, 180,
420, 60,
380, 100,
300, 100,
260, 60,
260, 140,
220, 100,
180, 100,
140, 140,
140, 80,
150, 80,
200, 40,
200, 20,
160, 20,
90, 80,
100, 160,
120, 270,
200, 270,
200, 230,
160, 230,
160, 210,
180, 190,
220, 190,
220, 270,
280, 270,
280, 230,
260, 230,
260, 180,
400, 200,
360, 220,
320, 220,
280, 180,
fill="lightblue", outline="brown", width=6)
botonVentanaHija = Button(ventanaHija, text="Cerrar (Eduardo Pablo Aquino Sanchez)",
command=lambda: ejecutar(ventanaHija.destroy()))
botonVentanaHija.pack()
elif num == 12:
figura = Canvas(ventanaHija)
figura.config(width=300, height=300, bg='white')
figura.pack(expand=YES, fill=BOTH)
puntosFigura1 = [37.29, 21.55,
53.89, 47.62,
31, 80,
46.38, 98.19,
76.8, 83.97,
78.38, 131.78,
97.34, 132.17,
98.92, 98.19,
135.67, 97.4,
136.85, 134.15,
155.03, 133.75,
153.84, 80.81,
175.57, 24.32,
137.25, 58.69,
78.78, 61.45,
66.53, 42.88]
for i in range(0, len(puntosFigura1)):
puntosFigura1[i] += 30
figura.create_polygon(puntosFigura1, fill="brown", outline="black", width=4)
botonVentanaHija = Button(ventanaHija, text="Cerrar (Orta Maldonado)", command=lambda: ejecutar(ventanaHija.destroy()))
botonVentanaHija.pack()
elif num == 13:
figura = Canvas(ventanaHija)
figura.config(width=400, height=600, bg='white')
figura.pack(expand=YES, fill=BOTH)
figura.create_polygon(52.5, 14.5, 37, 59.1, 51, 59.1, fill="#5C554E", outline="#5C554E", width=1)
figura.create_polygon(19.3, 56.8, 58, 59.1, 67, 91, 37.5, 83, fill="#C3BAB5", outline="#C3BAB5", width=1)
figura.create_polygon(58, 57.8, 78, 77, 71, 103, fill="#D4CCC1", outline="#D4CCC1", width=1)
figura.create_polygon(37.5, 83, 67.4, 91, 71, 103, fill="#998C8A", outline="#998C8A", width=1)
figura.create_polygon(71, 103, 71, 104.8, 59.1, 104.8, 53.2, 91, fill="#665B57", outline="#665B57", width=1)
figura.create_polygon(86, 105.6, 98.2, 148.6, 47, 133.6, 24.2, 103.6, fill="#C3BAB5", outline="#C3BAB5",
width=1)
figura.create_polygon(98.2, 148.6, 102, 165.2, 47, 133.6, fill="#9B8D8A", outline="#9B8D8A", width=1)
figura.create_polygon(86, 105.6, 124, 169, 120, 196, 110.8, 196, fill="#D5CDC2", outline="#D5CDC2", width=1)
figura.create_polygon(102, 165.2, 110.8, 196, 99, 196, 80.6, 153, fill="#605550", outline="#605550", width=1)
figura.create_polygon(139.5, 197, 147, 241, 71, 220.4, 46, 193, fill="#C3BAB5", outline="#C3BAB5", width=1)
figura.create_polygon(147, 241, 150, 261.4, 71, 220.4, fill="#968B87", outline="#968B87", width=1)
figura.create_polygon(139.5, 197, 193, 274.2, 189, 307.8, 176, 321, 161.6, 321, fill="#D4CCC1",
outline="#D4CCC1", width=1)
figura.create_polygon(150, 261.4, 161.6, 321, 126.8, 249, fill="#605551", outline="#605551", width=1)
figura.create_polygon(199.4, 307.8, 189, 307.8, 176, 321, 186.6, 461, 184, 448.8, 171, 479.5, 199.4, 503,
fill="#C2AD9C", outline="#C2AD9C", width=1)
figura.create_polygon(176, 321, 161.6, 321, 186.6, 461, fill="#615652", outline="#615652", width=1)
figura.create_polygon(161.6, 321, 136, 359.4, 177.2, 409, fill="#D9C6B7", outline="#D9C6B7", width=1)
figura.create_polygon(144.4, 369.8, 139.6, 384.6, 160, 389.4, fill="#443232", outline="#443232", width=1)
figura.create_polygon(139.6, 384.6, 160, 389.4, 177.2, 409, 169.2, 450, fill="#826E65", outline="#826E65",
width=1)
figura.create_polygon(171, 479.5, 180.6, 497.8, 191.2, 496.8, fill="#463334", outline="#463334", width=1)
figura.create_polygon(177.2, 409, 164.8, 475, 176.5, 511, 199.4, 522, 199.4, 502.8, 191.2, 496.8, 180.6, 497.8,
171, 479.5, 184, 448.8, fill="#9B7F79", outline="#9B7F79", width=1)
figura.create_polygon(151.8, 335.4, 109.6, 280, 142.2, 349.2, fill="#5F5150", outline="#5F5150", width=1)
figura.create_polygon(109.6, 280, 70.3, 266, 94.3, 329, 131.3, 326, fill="#483636", outline="#483636", width=1)
figura.create_polygon(94.3, 329, 137, 336, 132, 326.8, fill="#C2AF9D", outline="#C2AF9D", width=1)
figura.create_polygon(115, 333, 136, 359.4, 142.2, 349.2, 137, 336, fill="#826E65", outline="#826E65", width=1)
# Lado inverso
figura.create_polygon(346.5, 14.5, 347.5, 59.1, 361, 59.1, fill="#2E2621", outline="#2E2621", width=1)
figura.create_polygon(379.4, 56.8, 341.8, 59.1, 332, 91, 361, 83, fill="#908782", outline="#908782", width=1)
figura.create_polygon(341.5, 57.8, 324, 75, 327.6, 103, fill="#A29B8F", outline="#A29B8F", width=1)
figura.create_polygon(361, 83, 332.4, 91, 329, 103, fill="#685D59", outline="#685D59", width=1)
figura.create_polygon(329, 103, 326.8, 104.8, 340, 104.8, 345.6, 91, fill="#2D2220", outline="#2D2220", width=1)
figura.create_polygon(313, 105.6, 301, 148.6, 352, 133.6, 374.5, 103.6, fill="#908782", outline="#908782",
width=1)
figura.create_polygon(301, 148.6, 297, 165.2, 352, 133.6, fill="#625755", outline="#625755", width=1)
figura.create_polygon(313, 105.6, 274, 169, 279, 196, 288, 196, fill="#A1998E", outline="#A1998E", width=1)
figura.create_polygon(297, 165.2, 288, 196, 300, 196, 318, 153, fill="#2D221E", outline="#2D221E", width=1)
figura.create_polygon(260, 197, 252, 241, 331, 220.4, 352.4, 193, fill="#908782", outline="#908782", width=1)
figura.create_polygon(252, 241, 249, 261.4, 331, 220.4, fill="#645955", outline="#645955", width=1)
figura.create_polygon(260, 197, 205, 274.2, 209.8, 307.8, 223, 321, 238, 321, fill="#A1998E", outline="#A1998E",
width=1)
figura.create_polygon(249, 261.4, 238.6, 321, 271.8, 249, fill="#2D221E", outline="#2D221E", width=1)
figura.create_polygon(199.4, 307.8, 209.8, 307.8, 223, 321, 212.6, 461, 215, 448.8, 228, 479.5, 199.4, 503,
fill="#8E7968", outline="#8E7968", width=1)
figura.create_polygon(223, 321, 238.6, 321, 212.6, 461, fill="#302722", outline="#302722", width=1)
figura.create_polygon(238, 321, 262.8, 359.4, 222.5, 409, fill="#A69384", outline="#A69384", width=1)
figura.create_polygon(254.4, 369.8, 259.6, 384.6, 238, 389.4, fill="#120001", outline="#120001", width=1)
figura.create_polygon(259.6, 384.6, 238, 389.4, 222.5, 409, 229.5, 450, fill="#4F3B32", outline="#4F3B32",
width=1)
figura.create_polygon(228, 479.5, 218.3, 497.8, 207.5, 496.8, fill="#180A04", outline="#180A04", width=1)
figura.create_polygon(222.5, 409, 234, 475, 223, 511, 199.4, 522, 199.4, 502.8, 207.5, 496.8, 218.3, 497.8, 228,
479.5, 215, 448.8, fill="#674C45", outline="#674C45", width=1)
figura.create_polygon(247, 335.4, 290.6, 280, 256.8, 349.2, fill="#281F1D", outline="#281F1D", width=1)
figura.create_polygon(290.6, 280, 328, 266, 304.8, 329, 267.5, 326, fill="#140202", outline="#140202", width=1)
figura.create_polygon(304.8, 329, 262.5, 336, 267.5, 326.8, fill="#8D7B66", outline="#8D7B66", width=1)
figura.create_polygon(283, 333, 262.8, 359.4, 256.8, 349.2, 262.5, 336, fill="#4D3930", outline="#4D3930",
width=1)
botonVentanaHija = Button(ventanaHija, text="Cerrar (David Mendoza)", command=lambda: ejecutar(ventanaHija.destroy()))
botonVentanaHija.pack()
elif num == 14:
figura = Canvas(ventanaHija)
figura.config(width=400, height=400, bg='white')
figura.pack(expand=YES, fill=BOTH)
puntos = [00, 20, 60, 20, 80, 80, 120, 80, 160, 20, 220, 40, 180, 40, 140, 80, 160, 100, 160, 120, 160, 140,
140,
160, 180, 180, 200, 200, 200, 240, 180, 280, 140, 300, 180, 320, 180, 340, 120, 340, 100, 320, 80,
340,
20, 340, 20, 320, 60, 300, 20, 280, 00, 240, 00, 200, 20, 180, 60, 160, 40, 140, 40, 120, 40, 100, 60,
80,
40, 40]
figura.create_polygon(puntos, fill="black", outline="white", width=9)
botonVentanaHija = Button(ventanaHija, text="Cerrar (Lourdes Brito)", command=lambda: ejecutar(ventanaHija.destroy()))
botonVentanaHija.pack()
elif num == 15:
figura = Canvas(ventanaHija)
figura.config(width=800, height=600, bg='white')
figura.pack(expand=YES, fill=BOTH)
figura.create_polygon((200, 400), (100, 500), (100, 600), (200, 500), (300, 600), (300, 500), (200, 400),
(300, 300), fill="green", outline="brown", width=2)
figura.create_polygon((200, 200), (300, 100), (500, 100), (500, 300), (400, 400), (300, 300), fill="red",
outline="brown", width=2)
botonVentanaHija = Button(ventanaHija, text="Cerrar (Edgar Emanuel Mendez)",
command=lambda: ejecutar(ventanaHija.destroy()))
botonVentanaHija.pack()
elif num == 16:
puntos = [226, 42, 198, 42, 170, 50, 141, 71, 127, 60, 108, 52, 94, 57, 85, 71, 85, 85, 95, 99, 108, 106, 120,
109,
127, 113, 127, 123, 142, 119, 161, 119, 178, 122, 189, 134, 192, 148, 189, 161, 176, 166, 160, 165,
142,
162, 156, 178, 170, 192, 192, 198, 207, 198, 198, 212, 170, 209, 151, 205, 132, 202, 113, 195, 108,
180,
99, 164, 80, 153, 57, 156, 38, 170, 34, 183, 35, 198, 42, 212, 56, 221, 71, 226, 85, 221, 104, 212,
127,
223, 152, 226, 175, 232, 189, 234, 184, 250, 184, 270, 184, 283, 190, 297, 196, 306, 184, 321, 180,
334,
178, 346, 180, 353, 188, 372, 212, 390, 194, 402, 181, 411, 170, 425, 170, 443, 176, 456, 190, 467,
208,
468, 227, 456, 275, 419, 276, 404, 269, 393, 252, 383, 236, 382, 221, 371, 206, 361, 201, 350, 203,
340,
209, 333, 221, 326, 237, 326, 255, 322, 270, 314, 280, 305, 297, 291, 311, 288, 335, 288, 354, 293,
368,
301, 378, 311, 386, 326, 403, 330, 411, 330, 462, 265, 461, 240, 450, 230, 435, 226, 421, 226, 406,
230,
396, 240, 380, 270, 354, 265, 332, 260, 311, 263, 297, 263, 283, 263, 278, 250, 264, 226, 283, 226,
297,
221, 312, 212, 330, 198, 346, 198, 363, 198, 375, 188, 382, 175, 386, 160, 382, 141, 362, 127, 334,
127,
326, 133, 312, 148, 312, 163, 315, 180, 304, 192, 290, 204, 273, 206, 255, 205, 241, 204, 234, 198,
255,
189, 269, 180, 278, 166, 286, 151, 291, 132, 292, 113, 289, 99, 283, 85, 280, 74, 269, 63, 255, 51,
234,
42]
figura = Canvas(ventanaHija)
figura.config(width=500, height=500, bg='white')
figura.pack(expand=YES, fill=BOTH)
figura.create_polygon(puntos, fill="black", outline="white", width=6)
botonVentanaHija = Button(ventanaHija, text="Cerrar (Ricardo Castillo)",
command=lambda: ejecutar(ventanaHija.destroy()))
botonVentanaHija.pack()
elif num == 17:
figura = Canvas(ventanaHija)
figura.config(width=300, height=300, bg='white')
figura.pack(expand=YES, fill=BOTH)
figura.create_polygon(
15, 18,
180, 17.4,
180, 180,
129.8, 179.4,
130.2, 114.2,
151, 114,
151.2, 92.6,
129.8, 91.6,
129.6, 72.4,
132.6, 68.2,
135.6, 65.2,
140, 64.2,
153.4, 63.8,
153, 44.2,
128, 43.2,
122, 44.2,
117.4, 46.8,
114.2, 50.8,
110.8, 53.4,
108.8, 57.4,
106.4, 62.4,
105.8, 67,
106.4, 92,
84.8, 92.2,
85, 113.8,
105.6, 114.2,
105.8, 179.4,
15.2, 180,
fill="lightblue", outline="blue", width=6)
botonVentanaHija = Button(ventanaHija, text="Cerrar (Juan Rodolfo García)",
command=lambda: ejecutar(ventanaHija.destroy()))
botonVentanaHija.pack()
elif num == 18:
figura = Canvas(ventanaHija)
figura.config(width=900, height=600, bg='white')
figura.pack(expand=YES, fill=BOTH)
figura.create_polygon(300, 300, 400, 200, 500, 200, 600, 300, 700, 200, 800, 200, 900, 300, 878, 395, 600, 700,
325, 401, fill="red", outline="brown", width=6)
botonVentanaHija = Button(ventanaHija, text="Cerrar (Uriel Vega Jerez)",
command=lambda: ejecutar(ventanaHija.destroy()))
botonVentanaHija.pack()
elif num == 19:
po = Canvas(ventanaHija, width=1000, height=550)
po.pack()
p1 = Canvas(ventanaHija, width=92, height=61)
p1.place(x=446, y=30)
p1.create_polygon(52, 4, 10, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p2 = Canvas(ventanaHija, width=92, height=61)
p2.place(x=488, y=93)
p2.create_polygon(52, 4, 10, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p3 = Canvas(ventanaHija, width=92, height=61)
p3.place(x=400, y=93)
p3.create_polygon(52, 4, 10, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p4 = Canvas(ventanaHija, width=92, height=61)
p4.place(x=352, y=156)
p4.create_polygon(52, 4, 5, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p5 = Canvas(ventanaHija, width=92, height=61)
p5.place(x=300, y=220)
p5.create_polygon(52, 4, 10, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p6 = Canvas(ventanaHija, width=92, height=61)
p6.place(x=396, y=220)
p6.create_polygon(52, 4, 5, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p7 = Canvas(ventanaHija, width=92, height=61)
p7.place(x=532, y=156)
p7.create_polygon(50, 4, 10, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p8 = Canvas(ventanaHija, width=92, height=61)
p8.place(x=488, y=220)
p8.create_polygon(50, 4, 7, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p9 = Canvas(ventanaHija, width=92, height=61)
p9.place(x=578, y=220)
p9.create_polygon(50, 4, 7, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p10 = Canvas(ventanaHija, width=92, height=61)
p10.place(x=620, y=285) # abajo
p10.create_polygon(52, 4, 10, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p11 = Canvas(ventanaHija, width=92, height=61)
p11.place(x=664, y=350)
p11.create_polygon(52, 4, 10, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p12 = Canvas(ventanaHija, width=92, height=61)
p12.place(x=572, y=350)
p12.create_polygon(52, 4, 10, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p13 = Canvas(ventanaHija, width=92, height=61)
p13.place(x=524, y=414)
p13.create_polygon(52, 4, 5, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p14 = Canvas(ventanaHija, width=92, height=61)
p14.place(x=472, y=478)
p14.create_polygon(52, 4, 10, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p15 = Canvas(ventanaHija, width=92, height=61)
p15.place(x=566, y=478)
p15.create_polygon(52, 4, 5, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p16 = Canvas(ventanaHija, width=92, height=61)
p16.place(x=708, y=414)
p16.create_polygon(50, 4, 10, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p17 = Canvas(ventanaHija, width=92, height=61)
p17.place(x=754, y=478)
p17.create_polygon(50, 4, 7, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p18 = Canvas(ventanaHija, width=92, height=61)
p18.place(x=662, y=478)
p18.create_polygon(50, 4, 7, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p10 = Canvas(ventanaHija, width=92, height=61)
p10.place(x=252, y=285) # abajo
p10.create_polygon(52, 4, 10, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p11 = Canvas(ventanaHija, width=92, height=61)
p11.place(x=204, y=350)
p11.create_polygon(52, 4, 10, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p12 = Canvas(ventanaHija, width=92, height=61)
p12.place(x=296, y=350)
p12.create_polygon(52, 4, 10, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p13 = Canvas(ventanaHija, width=92, height=61)
p13.place(x=158, y=414)
p13.create_polygon(52, 4, 5, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p14 = Canvas(ventanaHija, width=92, height=61)
p14.place(x=106, y=478)
p14.create_polygon(52, 4, 10, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p15 = Canvas(ventanaHija, width=92, height=61)
p15.place(x=200, y=478)
p15.create_polygon(52, 4, 5, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p16 = Canvas(ventanaHija, width=92, height=61)
p16.place(x=340, y=414)
p16.create_polygon(50, 4, 10, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p17 = Canvas(ventanaHija, width=92, height=61)
p17.place(x=293, y=478)
p17.create_polygon(50, 4, 7, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p18 = Canvas(ventanaHija, width=92, height=61)
p18.place(x=383, y=478)
p18.create_polygon(50, 4, 7, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
botonVentanaHija = Button(ventanaHija, text="Cerrar (Armando Monreal)", command=lambda: ejecutar(ventanaHija.destroy()))
botonVentanaHija.pack()
elif num == 20:
figura = Canvas(ventanaHija)
figura.config(width=300, height=400, bg='white')
figura.pack(expand=YES, fill=BOTH)
c = [35, 65, 50, 55, 50, 50, 47.5, 40, 50, 35, 45, 25, 55, 30, 50, 20, 62.5, 27.5, 70, 15, 72.5, 25,
85, 15, 80, 27.5, 90, 25, 97.5, 27.5, 87.5, 32.5, 105, 35, 95, 47.5, 107.5, 52.5, 95, 62.5,
107.5, 70, 95, 80, 105, 85, 90, 100, 97.5, 105, 82.5, 125, 92.5, 122.5, 105, 110, 110, 100,
112.5, 115, 117.5, 122.5, 105, 127.5, 90, 132.5, 80, 135, 90, 137.5, 100, 135, 115, 130,
112.5, 140, 117.5, 147.5, 95, 147.5, 75, 140, 85, 150, 95, 155, 115, 157.5, 100, 172.5,
110, 180, 120, 195, 125, 205, 127.5, 215, 127.5, 235, 122.5, 255, 115, 275, 105, 290, 90, 300,
75, 305, 60, 300, 50, 295, 40, 282.5, 37.5, 265, 39, 255, 45, 240, 55, 232.5, 65, 230, 75, 235,
80, 240, 80, 250, 70, 260, 60, 262.5, 57.5, 250, 60, 245, 65, 245, 62.5, 250, 65, 255, 75, 250,
75, 242.5, 65, 237.5, 55, 240, 50, 245, 46.5, 255, 45, 265, 47.5, 275, 55, 285, 65, 287.5,
75, 287.5, 85, 282.5, 92.5, 275, 97.5, 265, 100, 255, 102.5, 245, 102.5, 235, 100, 225, 95, 215,
85, 205, 75, 197.5, 65, 192.5, 55, 182.5, 47.5, 175, 40, 165, 32.5, 155, 30, 145, 30, 120, 35, 110,
45, 100, 55, 90, 65, 80, 71, 71, 75, 60, 70, 55, 60, 60, 50, 65, 40, 67.5, 35, 65]
for i in range(0, len(c)):
c[i] = c[i] + 20
figura.create_polygon(c, fill="green", outline="black", width=2)
botonVentanaHija = Button(ventanaHija, text="Cerrar (Carlos Guzman Rubio)",
command=lambda: ejecutar(ventanaHija.destroy()))
botonVentanaHija.pack()
elif num == 21:
figura = Canvas(ventanaHija)
figura.config(width=300, height=200, bg='white')
figura.pack(expand=YES, fill=BOTH)
figura.create_polygon(50, 20, 100, 20, 100, 30, 130, 30, 130, 40, 110, 40, 110, 50, 130, 50, 130, 60, 140, 60,
140,
70, 130, 70, 130, 80, 120, 80, 120, 90, 100, 90, 100, 100, 130, 100, 130, 110, 140, 110,
140,
150, 120, 150, 120, 160, 130, 160, 130, 170, 140, 170, 140, 180, 100, 180, 100, 160, 90,
160,
90, 150, 70, 150, 70, 160, 60, 160, 60, 180, 20, 180, 20, 170, 30, 170, 30, 160, 40, 160,
40,
150, 20, 150, 20, 110, 30, 110, 30, 100, 40, 100, 40, 90, 50, 90, 50, 80, 30, 80, 30, 50,
40,
50, 40, 30, 50, 30, fill="red", outline='white')
botonVentanaHija = Button(ventanaHija, text="Cerrar (Jonathan Guzman Jaramillo)",
command=lambda: ejecutar(ventanaHija.destroy()))
botonVentanaHija.pack()
elif num == 22:
figura = Canvas(ventanaHija)
figura.config(width=800, height=500, bg='white')
figura.pack(expand=YES, fill=BOTH)
figura.create_polygon(250, 50, 200, 50, 200, 100, 250, 100, 250, 150, 200, 150, 200,
200, 150, 200, 150, 250, 100, 250, 100, 400, 150, 400, 150, 300,
200, 300, 200, 450, 350, 450, 350, 400, 250, 400, 250, 350, 500, 350,
500, 400, 400, 400, 400, 450, 550, 450, 550, 300, 600, 300, 600, 400,
650, 400, 650, 250, 600, 250, 600, 200, 550, 200, 550, 150, 500, 150, 500,
100, 550, 100, 550, 50, 450, 50, 450, 150, 300, 150, 300, 50, fill="black",
outline="lightblue", width=6)
figura.create_polygon(250, 200, 250, 250, 300, 250, 300, 200, fill="white", outline="white", width=6)
figura.create_polygon(500, 200, 450, 200, 450, 250, 500, 250, fill="white", outline="white", width=6)
botonVentanaHija = Button(ventanaHija, text="Cerrar (Pedro Escoto Aguirre)",
command=lambda: ejecutar(ventanaHija.destroy()))
botonVentanaHija.pack()
#Lista de etiquetas de la ventana principal
etiquetaT1 = Label(ventanaPrincipal, text="Figuras realizadas en clase", bg="orange", font="Arial 12 bold",pady=10)
etiquetaT1.grid(row=1, column=1, columnspan=9)
etiquetaT2 = Label(ventanaPrincipal, text="Figuras realizadas por compañeros de clase", bg="orange", font="Arial 12 bold",pady=10)
etiquetaT2.grid(row=3, column=1, columnspan=9)
#Lista de botones de la ventana principal
botonCirculo = Button(ventanaPrincipal, text="Mostrar círculo", command=lambda: ejecutar(mostrar(1)))
botonCirculo.grid (row=2, column=1,sticky="W,E")
botonRectangulo = Button(ventanaPrincipal, text="Mostrar rectángulo", command=lambda: ejecutar(mostrar(2)))
botonRectangulo.grid (row=2, column=2,sticky="W,E")
botonLineas = Button(ventanaPrincipal, text="Mostrar línea", command=lambda: ejecutar(mostrar(3)))
botonLineas.grid (row=2, column=3,sticky="W,E")
botonQuesito = Button(ventanaPrincipal, text="Mostrar quesito", command=lambda: ejecutar(mostrar(4)))
botonQuesito.grid (row=2, column=4,sticky="W,E")
botonArco = Button(ventanaPrincipal, text="Mostrar arco", command=lambda: ejecutar(mostrar(5)))
botonArco.grid (row=2, column=5,sticky="W,E")
botonPastel = Button(ventanaPrincipal, text="Mostrar pastel", command=lambda: ejecutar(mostrar(6)))
botonPastel.grid (row=2, column=6,sticky="W,E")
botonTexto = Button(ventanaPrincipal, text="Mostrar texto", command=lambda: ejecutar(mostrar(7)))
botonTexto.grid (row=2, column=7,sticky="W,E")
botonPoligono = Button(ventanaPrincipal, text="Mostrar polígono", command=lambda: ejecutar(mostrar(8)))
botonPoligono.grid (row=2, column=8,sticky="W,E")
botonPoligono = Button(ventanaPrincipal, text="Mostrar letras", command=lambda: ejecutar(mostrar(9)))
botonPoligono.grid (row=2, column=9,sticky="W,E")
botonEstrella = Button(ventanaPrincipal, text="Mostrar estrella", command=lambda: ejecutar(mostrar(10)))
botonEstrella.grid (row=4, column=1,sticky="W,E")
botonGato = Button(ventanaPrincipal, text="Mostrar gatito", command=lambda: ejecutar(mostrar(11)))
botonGato.grid (row=4, column=2,sticky="W,E")
botonPerro = Button(ventanaPrincipal, text="Mostrar perrito", command=lambda: ejecutar(mostrar(12)))
botonPerro.grid (row=4, column=3,sticky="W,E")
botonAntilope = Button(ventanaPrincipal, text="Mostrar antílope", command=lambda: ejecutar(mostrar(13)))
botonAntilope.grid (row=4, column=4,sticky="W,E")
botonConejo = Button(ventanaPrincipal, text="Mostrar conejo", command=lambda: ejecutar(mostrar(14)))
botonConejo.grid (row=4, column=5,sticky="W,E")
botonManzana = Button(ventanaPrincipal, text="Mostrar manzana", command=lambda: ejecutar(mostrar(15)))
botonManzana.grid (row=4, column=6,sticky="W,E")
botonMonito = Button(ventanaPrincipal, text="Mostrar monito", command=lambda: ejecutar(mostrar(16)))
botonMonito.grid (row=4, column=7,sticky="W,E")
botonFacebook = Button(ventanaPrincipal, text="Mostrar facebook", command=lambda: ejecutar(mostrar(17)))
botonFacebook.grid (row=4, column=8,sticky="W,E")
botonCorazon = Button(ventanaPrincipal, text="Mostrar corazon", command=lambda: ejecutar(mostrar(18)))
botonCorazon.grid (row=4, column=9,sticky="W,E")
botonTrifuerza = Button(ventanaPrincipal, text="Mostrar trifuerza", command=lambda: ejecutar(mostrar(19)))
botonTrifuerza.grid (row=5, column=1,sticky="W,E")
botonHipocampo = Button(ventanaPrincipal, text="Mostrar hipocampo", command=lambda: ejecutar(mostrar(20)))
botonHipocampo.grid (row=5, column=2,sticky="W,E")
botonMario = Button(ventanaPrincipal, text="Mostrar mario", command=lambda: ejecutar(mostrar(21)))
botonMario.grid (row=5, column=3,sticky="W,E")
botonInvader = Button(ventanaPrincipal, text="Mostrar invader", command=lambda: ejecutar(mostrar(22)))
botonInvader.grid (row=5, column=4,sticky="W,E")
ventanaPrincipal.mainloop()
lunes, 2 de octubre de 2017
Poligonos Tkinter con funciones
#-*- coding: utf-8 -*-
from Tkinter import *
ventanaPrincipal = Tk() # Tk() Es la ventana principal
ventanaPrincipal.title("Ventana principal") # Título de la ventana
ventanaPrincipal.config(bg="orange") # Le da color al fondo
ventanaPrincipal.geometry("891x400") # Cambia el tamaño de la ventana
def ventanaH():
ventanaHija = Toplevel(ventanaPrincipal)
ventanaHija.title("Ventana hija")
ventanaHija.protocol("WM_DELETE_WINDOW", "onexit")
return ventanaHija
def ejecutar(f):
ventanaPrincipal.after(200, f) # Una forma de ejecutar las funciones
def circulo():
ventana = ventanaH()
ventana.deiconify()
figura = Canvas(ventana)
figura.config(width=210, height=210,bg='red') # Lienzo con las medidas y color sobre el que se dibujará la figura
figura.pack(expand=YES, fill=BOTH) # Sirve para cargar la figura
figura.create_oval(10, 10, 200, 200, width=3, fill='blue') # Coordenadas y características de la figura
botonVentanaHija = Button(ventana, text="Cerrar", command=lambda: ejecutar(ventana.destroy()))
botonVentanaHija.pack()
def rectangulo():
ventana = ventanaH()
ventana.deiconify()
figura = Canvas(ventana)
figura.config(width=210, height=210,bg='white') # Lienzo con las medidas y color sobre el que se dibujará la figura
figura.pack(expand=YES, fill=BOTH) # Sirve para cargar la figura
figura.create_rectangle(10, 10, 200, 200, width=5, fill='yellow') # Coordenadas y características de la figura
botonVentanaHija = Button(ventana, text="Cerrar", command=lambda: ejecutar(ventana.destroy()))
botonVentanaHija.pack()
def lineas():
ventana = ventanaH()
ventana.deiconify()
figura = Canvas(ventana)
figura.config(width=210, height=210,bg='gray') # Lienzo con las medidas y color sobre el que se dibujará la figura
figura.pack(expand=YES, fill=BOTH) # Sirve para cargar la figura
figura.create_line(0, 200, 200, 0, width=10, fill='purple') # Coordenadas y características de la figura
botonVentanaHija = Button(ventana, text="Cerrar", command=lambda: ejecutar(ventana.destroy()))
botonVentanaHija.pack()
def quesito():
ventana = ventanaH()
ventana.deiconify()
figura = Canvas(ventana)
figura.config(width=300, height=200, bg='white') # Lienzo con las medidas y color sobre el que se dibujará la figura
figura.pack(expand=YES, fill=BOTH) # Sirve para cargar la figura
figura.create_arc(10, 10, 190, 190, width=3, start=270, extent=90, fill='pink') # Coordenadas y características de la figura
botonVentanaHija = Button(ventana, text="Cerrar", command=lambda: ejecutar(ventana.destroy()))
botonVentanaHija.pack()
def arco():
ventana = ventanaH()
ventana.deiconify()
figura = Canvas(ventana)
figura.config(width =300, height=200, bg='gray') # Lienzo con las medidas y color sobre el que se dibujará la figura
figura.pack(expand=YES, fill=BOTH) # Sirve para cargar la figura
figura.create_arc(10, 10, 190, 190, width=3, start=0, extent=270, fill='yellow') # Coordenadas y características de la figura
botonVentanaHija = Button(ventana, text="Cerrar", command=lambda: ejecutar(ventana.destroy()))
botonVentanaHija.pack()
def pastel():
ventana = ventanaH()
ventana.deiconify()
figura = Canvas(ventana)
figura.config(width=300, height=300, bg='gray') # Lienzo con las medidas y color sobre el que se dibujará la figura
figura.pack(expand=YES, fill=BOTH) # Sirve para cargar la figura
figura.create_arc(10, 10, 190, 190, width=3, start=0, extent=270, fill='orange') # Coordenadas y características de la figura
figura.create_arc(20, 20, 200, 200, width=3, start=270, extent=90, fill='brown')
botonVentanaHija = Button(ventana, text="Cerrar", command=lambda: ejecutar(ventana.destroy()))
botonVentanaHija.pack()
def texto():
ventana = ventanaH()
ventana.deiconify()
figura = Canvas(ventana)
figura.config(width=400, height=300, bg='yellow') # Lienzo con las medidas y color sobre el que se dibujará la figura
figura.pack(expand=YES, fill=BOTH) # Sirve para cargar la figura
figura.create_text(160,100,fill="purple",font="Times 30 italic bold",text="Texto\n hecho en python.")
botonVentanaHija = Button(ventana, text="Cerrar", command=lambda: ejecutar(ventana.destroy()))
botonVentanaHija.pack()
def poligono():
ventana = ventanaH()
ventana.deiconify()
figura = Canvas(ventana)
figura.config(width=400, height=300,bg='gray') # Lienzo con las medidas y color sobre el que se dibujará la figura
figura.pack(expand=YES, fill=BOTH) # Sirve para cargar la figura
figura.create_polygon(40, 40, 40, 140, 140, 140, 140, 100,fill="orange", outline="brown", width=6)
botonVentanaHija = Button(ventana, text="Cerrar", command=lambda: ejecutar(ventana.destroy()))
botonVentanaHija.pack()
def letras():
ventana = ventanaH()
ventana.deiconify()
figura = Canvas(ventana)
figura.config(width=400, height=300, bg='white') # Lienzo con las medidas y color sobre el que se dibujará la figura
figura.pack(expand=YES, fill=BOTH) # Sirve para cargar la figura
puntosFigura1 = [40, 40, 40, 200, 60, 200, 60, 80, 100, 160, 140, 80, 140, 200, 160, 200, 160, 40, 140, 40, 100, 120, 60, 40]
figura.create_polygon(puntosFigura1, fill="#006600", outline="black", width=6)
puntosFigura2=[40, 40, 60, 40, 80, 100, 100, 40, 120, 40, 90, 120, 120, 200, 100, 200, 80, 140, 60, 200, 40, 200, 70, 120]
for i in range(0,len(puntosFigura2)):
if(i%2==0):
puntosFigura2[i] +=140
figura.create_polygon(puntosFigura2, fill="red", outline="black", width=6)
botonVentanaHija = Button(ventana, text="Cerrar", command=lambda: ejecutar(ventana.destroy()))
botonVentanaHija.pack()
def estrella():
ventana = ventanaH()
ventana.deiconify()
figura = Canvas(ventana)
figura.config(width=300, height=300,bg='white')
figura.pack(expand=YES, fill=BOTH)
puntosFigura1 = [130,20,
150,90,
210,90,
160,130,
180,200,
130,160,
80,200,
100,130,
50,90,
110,90]
for i in range(0, len(puntosFigura1)):
puntosFigura1[i] += 30
figura.create_polygon(puntosFigura1, fill="yellow", outline="black", width=4)
botonVentanaHija = Button(ventana, text="Cerrar (David Maldonado)", command=lambda: ejecutar(ventana.destroy()))
botonVentanaHija.pack()
def gatito():
ventana = ventanaH()
ventana.deiconify()
figura = Canvas(ventana)
figura.config(width=500, height=300,bg='white')
figura.pack(expand=YES, fill=BOTH)
figura.create_polygon(420, 180,
420, 60,
380, 100,
300, 100,
260, 60,
260, 140,
220, 100,
180, 100,
140, 140,
140, 80,
150, 80,
200, 40,
200, 20,
160, 20,
90, 80,
100, 160,
120, 270,
200, 270,
200, 230,
160, 230,
160, 210,
180, 190,
220, 190,
220, 270,
280, 270,
280, 230,
260, 230,
260, 180,
400, 200,
360, 220,
320, 220,
280, 180,
fill="lightblue", outline="brown", width=6)
botonVentanaHija = Button(ventana, text="Cerrar (Eduardo Pablo Aquino Sanchez)", command=lambda: ejecutar(ventana.destroy()))
botonVentanaHija.pack()
def perrito():
ventana = ventanaH()
ventana.deiconify()
figura = Canvas(ventana)
figura.config(width=300, height=300,bg='white')
figura.pack(expand=YES, fill=BOTH)
puntosFigura1 = [37.29,21.55,
53.89,47.62,
31,80,
46.38,98.19,
76.8,83.97,
78.38,131.78,
97.34,132.17,
98.92,98.19,
135.67,97.4,
136.85,134.15,
155.03,133.75,
153.84,80.81,
175.57,24.32,
137.25,58.69,
78.78,61.45,
66.53,42.88]
for i in range(0, len(puntosFigura1)):
puntosFigura1[i] += 30
figura.create_polygon(puntosFigura1, fill="brown", outline="black", width=4)
botonVentanaHija = Button(ventana, text="Cerrar (Orta Maldonado)", command=lambda: ejecutar(ventana.destroy()))
botonVentanaHija.pack()
def antilope():
ventana = ventanaH()
ventana.deiconify()
figura = Canvas(ventana)
figura.config(width=400, height=600, bg='white')
figura.pack(expand=YES, fill=BOTH)
figura.create_polygon(52.5,14.5,37,59.1,51,59.1, fill="#5C554E", outline="#5C554E", width=1)
figura.create_polygon(19.3, 56.8,58,59.1,67,91,37.5,83, fill="#C3BAB5", outline="#C3BAB5", width=1)
figura.create_polygon(58, 57.8, 78, 77, 71, 103, fill="#D4CCC1", outline="#D4CCC1", width=1)
figura.create_polygon(37.5, 83,67.4,91,71,103, fill="#998C8A", outline="#998C8A", width=1)
figura.create_polygon(71, 103, 71,104.8, 59.1,104.8,53.2,91,fill="#665B57", outline="#665B57", width=1)
figura.create_polygon(86,105.6,98.2,148.6,47,133.6,24.2,103.6, fill="#C3BAB5", outline="#C3BAB5", width=1)
figura.create_polygon(98.2, 148.6,102,165.2, 47,133.6, fill="#9B8D8A", outline="#9B8D8A", width=1)
figura.create_polygon(86,105.6,124,169, 120,196,110.8,196, fill="#D5CDC2", outline="#D5CDC2", width=1)
figura.create_polygon(102,165.2,110.8,196,99,196,80.6,153, fill="#605550", outline="#605550", width=1)
figura.create_polygon(139.5, 197, 147, 241, 71, 220.4, 46, 193, fill="#C3BAB5", outline="#C3BAB5", width=1)
figura.create_polygon(147, 241, 150, 261.4, 71, 220.4, fill="#968B87", outline="#968B87", width=1)
figura.create_polygon(139.5, 197, 193, 274.2, 189, 307.8, 176, 321, 161.6, 321, fill="#D4CCC1", outline="#D4CCC1",width=1)
figura.create_polygon(150, 261.4, 161.6, 321, 126.8, 249, fill="#605551", outline="#605551", width=1)
figura.create_polygon(199.4,307.8,189,307.8, 176,321,186.6,461,184,448.8,171,479.5,199.4,503,fill="#C2AD9C", outline="#C2AD9C", width=1)
figura.create_polygon(176, 321, 161.6, 321,186.6,461,fill="#615652", outline="#615652", width=1)
figura.create_polygon(161.6, 321, 136, 359.4,177.2,409,fill="#D9C6B7", outline="#D9C6B7", width=1)
figura.create_polygon(144.4,369.8, 139.6,384.6,160,389.4,fill="#443232", outline="#443232", width=1)
figura.create_polygon(139.6, 384.6, 160, 389.4,177.2,409,169.2,450, fill="#826E65", outline="#826E65", width=1)
figura.create_polygon(171,479.5,180.6,497.8,191.2,496.8, fill="#463334", outline="#463334", width=1)
figura.create_polygon(177.2, 409,164.8,475,176.5,511,199.4,522,199.4,502.8,191.2,496.8,180.6,497.8,171,479.5,184,448.8, fill="#9B7F79", outline="#9B7F79", width=1)
figura.create_polygon(151.8,335.4,109.6,280,142.2,349.2, fill="#5F5150", outline="#5F5150", width=1)
figura.create_polygon(109.6, 280, 70.3,266,94.3,329,131.3,326, fill="#483636", outline="#483636", width=1)
figura.create_polygon(94.3, 329,137,336,132,326.8, fill="#C2AF9D", outline="#C2AF9D", width=1)
figura.create_polygon(115, 333, 136, 359.4, 142.2,349.2,137,336, fill="#826E65", outline="#826E65", width=1)
#Lado inverso
figura.create_polygon(346.5, 14.5,347.5,59.1,361,59.1, fill="#2E2621", outline="#2E2621", width=1)
figura.create_polygon(379.4, 56.8, 341.8, 59.1, 332, 91, 361, 83, fill="#908782", outline="#908782", width=1)
figura.create_polygon(341.5, 57.8, 324, 75, 327.6, 103, fill="#A29B8F", outline="#A29B8F", width=1)
figura.create_polygon(361, 83, 332.4, 91, 329, 103, fill="#685D59", outline="#685D59", width=1)
figura.create_polygon(329, 103, 326.8, 104.8, 340, 104.8, 345.6, 91, fill="#2D2220", outline="#2D2220", width=1)
figura.create_polygon(313, 105.6, 301, 148.6, 352, 133.6, 374.5, 103.6, fill="#908782", outline="#908782", width=1)
figura.create_polygon(301, 148.6, 297, 165.2, 352, 133.6, fill="#625755", outline="#625755", width=1)
figura.create_polygon(313, 105.6, 274, 169,279, 196, 288, 196, fill="#A1998E", outline="#A1998E", width=1)
figura.create_polygon(297, 165.2, 288, 196,300,196, 318, 153, fill="#2D221E", outline="#2D221E", width=1)
figura.create_polygon(260,197,252,241,331,220.4,352.4,193, fill="#908782", outline="#908782", width=1)
figura.create_polygon(252, 241, 249, 261.4, 331,220.4, fill="#645955", outline="#645955", width=1)
figura.create_polygon(260, 197, 205,274.2, 209.8,307.8,223,321,238,321, fill="#A1998E", outline="#A1998E", width=1)
figura.create_polygon(249, 261.4,238.6,321,271.8,249, fill="#2D221E", outline="#2D221E", width=1)
figura.create_polygon(199.4, 307.8, 209.8,307.8, 223,321, 212.6, 461, 215, 448.8, 228, 479.5, 199.4, 503,fill="#8E7968", outline="#8E7968", width=1)
figura.create_polygon(223, 321, 238.6,321, 212.6, 461, fill="#302722", outline="#302722", width=1)
figura.create_polygon(238, 321, 262.8, 359.4, 222.5, 409, fill="#A69384", outline="#A69384", width=1)
figura.create_polygon(254.4, 369.8, 259.6, 384.6, 238, 389.4, fill="#120001", outline="#120001", width=1)
figura.create_polygon(259.6, 384.6, 238, 389.4, 222.5, 409, 229.5, 450, fill="#4F3B32", outline="#4F3B32", width=1)
figura.create_polygon(228, 479.5, 218.3, 497.8, 207.5, 496.8, fill="#180A04", outline="#180A04", width=1)
figura.create_polygon(222.5, 409, 234, 475, 223, 511, 199.4, 522, 199.4, 502.8, 207.5, 496.8, 218.3, 497.8, 228,
479.5, 215, 448.8, fill="#674C45", outline="#674C45", width=1)
figura.create_polygon(247, 335.4, 290.6, 280, 256.8, 349.2, fill="#281F1D", outline="#281F1D", width=1)
figura.create_polygon(290.6, 280, 328, 266, 304.8, 329, 267.5, 326, fill="#140202", outline="#140202", width=1)
figura.create_polygon(304.8, 329, 262.5, 336, 267.5, 326.8, fill="#8D7B66", outline="#8D7B66", width=1)
figura.create_polygon(283, 333, 262.8, 359.4, 256.8, 349.2, 262.5, 336, fill="#4D3930", outline="#4D3930", width=1)
botonVentanaHija = Button(ventana, text="Cerrar (David Mendoza)", command=lambda: ejecutar(ventana.destroy()))
botonVentanaHija.pack()
def conejo():
ventana = ventanaH()
ventana.deiconify()
figura = Canvas(ventana)
figura.config(width=400, height=400,bg='white')
figura.pack(expand=YES, fill=BOTH)
puntos = [00, 20, 60, 20, 80, 80, 120, 80, 160, 20, 220, 40, 180, 40, 140, 80, 160, 100, 160, 120, 160, 140, 140,
160, 180, 180, 200, 200, 200, 240, 180, 280, 140, 300, 180, 320, 180, 340, 120, 340, 100, 320, 80, 340,
20, 340, 20, 320, 60, 300, 20, 280, 00, 240, 00, 200, 20, 180, 60, 160, 40, 140, 40, 120, 40, 100, 60, 80,
40, 40]
figura.create_polygon(puntos, fill="black", outline="white", width=9)
botonVentanaHija = Button(ventana, text="Cerrar (Lourdes Brito)", command=lambda: ejecutar(ventana.destroy()))
botonVentanaHija.pack()
def manzana():
ventana = ventanaH()
ventana.deiconify()
figura = Canvas(ventana)
figura.config(width=800, height=600,bg='white')
figura.pack(expand=YES, fill=BOTH)
figura.create_polygon((200, 400), (100, 500), (100, 600), (200, 500), (300, 600), (300, 500), (200, 400),
(300, 300), fill="green", outline="brown", width=2)
figura.create_polygon((200, 200), (300, 100), (500, 100), (500, 300), (400, 400), (300, 300), fill="red",
outline="brown", width=2)
botonVentanaHija = Button(ventana, text="Cerrar (Edgar Emanuel Mendez)", command=lambda: ejecutar(ventana.destroy()))
botonVentanaHija.pack()
def monito():
puntos = [226, 42, 198, 42, 170, 50, 141, 71, 127, 60, 108, 52, 94, 57, 85, 71, 85, 85, 95, 99, 108, 106, 120, 109,
127, 113, 127, 123, 142, 119, 161, 119, 178, 122, 189, 134, 192, 148, 189, 161, 176, 166, 160, 165, 142,
162, 156, 178, 170, 192, 192, 198, 207, 198, 198, 212, 170, 209, 151, 205, 132, 202, 113, 195, 108, 180,
99, 164, 80, 153, 57, 156, 38, 170, 34, 183, 35, 198, 42, 212, 56, 221, 71, 226, 85, 221, 104, 212, 127,
223, 152, 226, 175, 232, 189, 234, 184, 250, 184, 270, 184, 283, 190, 297, 196, 306, 184, 321, 180, 334,
178, 346, 180, 353, 188, 372, 212, 390, 194, 402, 181, 411, 170, 425, 170, 443, 176, 456, 190, 467, 208,
468, 227, 456, 275, 419, 276, 404, 269, 393, 252, 383, 236, 382, 221, 371, 206, 361, 201, 350, 203, 340,
209, 333, 221, 326, 237, 326, 255, 322, 270, 314, 280, 305, 297, 291, 311, 288, 335, 288, 354, 293, 368,
301, 378, 311, 386, 326, 403, 330, 411, 330, 462, 265, 461, 240, 450, 230, 435, 226, 421, 226, 406, 230,
396, 240, 380, 270, 354, 265, 332, 260, 311, 263, 297, 263, 283, 263, 278, 250, 264, 226, 283, 226, 297,
221, 312, 212, 330, 198, 346, 198, 363, 198, 375, 188, 382, 175, 386, 160, 382, 141, 362, 127, 334, 127,
326, 133, 312, 148, 312, 163, 315, 180, 304, 192, 290, 204, 273, 206, 255, 205, 241, 204, 234, 198, 255,
189, 269, 180, 278, 166, 286, 151, 291, 132, 292, 113, 289, 99, 283, 85, 280, 74, 269, 63, 255, 51, 234,
42]
ventana = ventanaH()
ventana.deiconify()
figura = Canvas(ventana)
figura.config(width=500, height=500,bg='white')
figura.pack(expand=YES, fill=BOTH)
figura.create_polygon(puntos, fill="black", outline="white", width=6)
botonVentanaHija = Button(ventana,text="Cerrar (Ricardo Castillo)", command=lambda: ejecutar(ventana.destroy()))
botonVentanaHija.pack()
def facebook():
ventana = ventanaH()
ventana.deiconify()
figura = Canvas(ventana)
figura.config(width=300, height=300,bg='white')
figura.pack(expand=YES, fill=BOTH)
figura.create_polygon(
15, 18,
180, 17.4,
180, 180,
129.8, 179.4,
130.2, 114.2,
151, 114,
151.2, 92.6,
129.8, 91.6,
129.6, 72.4,
132.6, 68.2,
135.6, 65.2,
140, 64.2,
153.4, 63.8,
153, 44.2,
128, 43.2,
122, 44.2,
117.4, 46.8,
114.2, 50.8,
110.8, 53.4,
108.8, 57.4,
106.4, 62.4,
105.8, 67,
106.4, 92,
84.8, 92.2,
85, 113.8,
105.6, 114.2,
105.8, 179.4,
15.2, 180,
fill="lightblue", outline="blue", width=6)
botonVentanaHija = Button(ventana, text="Cerrar (Juan Rodolfo García)", command=lambda: ejecutar(ventana.destroy()))
botonVentanaHija.pack()
def corazon():
ventana = ventanaH()
ventana.deiconify()
figura = Canvas(ventana)
figura.config(width=900, height=600,bg='white')
figura.pack(expand=YES, fill=BOTH)
figura.create_polygon(300, 300, 400, 200, 500, 200, 600, 300, 700, 200, 800, 200, 900, 300, 878, 395, 600, 700,325, 401, fill="red", outline="brown", width=6)
botonVentanaHija = Button(ventana, text="Cerrar (Uriel Vega Jerez)", command=lambda: ejecutar(ventana.destroy()))
botonVentanaHija.pack()
def megatrifuerza():
v1 = ventanaH()
v1.deiconify()
po=Canvas(v1,width=1000, height=550)
po.pack()
p1=Canvas(v1,width=92, height=61)
p1.place(x=446,y=30)
p1.create_polygon(52, 4, 10, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p2=Canvas(v1,width=92, height=61)
p2.place(x=488,y=93)
p2.create_polygon(52, 4, 10, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p3=Canvas(v1,width=92, height=61)
p3.place(x=400,y=93)
p3.create_polygon(52, 4, 10, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p4=Canvas(v1,width=92, height=61)
p4.place(x=352,y=156)
p4.create_polygon(52, 4, 5, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p5=Canvas(v1,width=92, height=61)
p5.place(x=300,y=220)
p5.create_polygon(52, 4, 10, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p6=Canvas(v1,width=92, height=61)
p6.place(x=396,y=220)
p6.create_polygon(52, 4, 5, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p7=Canvas(v1,width=92, height=61)
p7.place(x=532,y=156)
p7.create_polygon(50, 4, 10, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p8=Canvas(v1,width=92, height=61)
p8.place(x=488,y=220)
p8.create_polygon(50, 4, 7, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p9=Canvas(v1,width=92, height=61)
p9.place(x=578,y=220)
p9.create_polygon(50, 4, 7, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p10=Canvas(v1,width=92, height=61)
p10.place(x=620,y=285) #abajo
p10.create_polygon(52, 4, 10, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p11=Canvas(v1,width=92, height=61)
p11.place(x=664,y=350)
p11.create_polygon(52, 4, 10, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p12=Canvas(v1,width=92, height=61)
p12.place(x=572,y=350)
p12.create_polygon(52, 4, 10, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p13=Canvas(v1,width=92, height=61)
p13.place(x=524,y=414)
p13.create_polygon(52, 4, 5, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p14=Canvas(v1,width=92, height=61)
p14.place(x=472,y=478)
p14.create_polygon(52, 4, 10, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p15=Canvas(v1,width=92, height=61)
p15.place(x=566,y=478)
p15.create_polygon(52, 4, 5, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p16=Canvas(v1,width=92, height=61)
p16.place(x=708,y=414)
p16.create_polygon(50, 4, 10, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p17=Canvas(v1,width=92, height=61)
p17.place(x=754,y=478)
p17.create_polygon(50, 4, 7, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p18=Canvas(v1,width=92, height=61)
p18.place(x=662,y=478)
p18.create_polygon(50, 4, 7, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p10=Canvas(v1,width=92, height=61)
p10.place(x=252,y=285) #abajo
p10.create_polygon(52, 4, 10, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p11=Canvas(v1,width=92, height=61)
p11.place(x=204,y=350)
p11.create_polygon(52, 4, 10, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p12=Canvas(v1,width=92, height=61)
p12.place(x=296,y=350)
p12.create_polygon(52, 4, 10, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p13=Canvas(v1,width=92, height=61)
p13.place(x=158,y=414)
p13.create_polygon(52, 4, 5, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p14=Canvas(v1,width=92, height=61)
p14.place(x=106,y=478)
p14.create_polygon(52, 4, 10, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p15=Canvas(v1,width=92, height=61)
p15.place(x=200,y=478)
p15.create_polygon(52, 4, 5, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p16=Canvas(v1,width=92, height=61)
p16.place(x=340,y=414)
p16.create_polygon(50, 4, 10, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p17=Canvas(v1,width=92, height=61)
p17.place(x=293,y=478)
p17.create_polygon(50, 4, 7, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
p18=Canvas(v1,width=92, height=61)
p18.place(x=383,y=478)
p18.create_polygon(50, 4, 7, 60, 60, 60, 90, 60, fill="#FCFF00", outline="#FFF715", width=6)
botonVentanaHija = Button(v1, text="Cerrar (Armando Monreal)", command=lambda: ejecutar(v1.destroy()))
botonVentanaHija.pack()
def hipocampo():
ventana = ventanaH()
ventana.deiconify()
figura = Canvas(ventana)
figura.config(width=300, height=400, bg='white')
figura.pack(expand=YES, fill=BOTH)
c = [35, 65, 50, 55, 50, 50, 47.5, 40, 50, 35, 45, 25, 55, 30, 50, 20, 62.5, 27.5, 70, 15, 72.5, 25,
85, 15, 80, 27.5, 90, 25, 97.5, 27.5, 87.5, 32.5, 105, 35, 95, 47.5, 107.5, 52.5, 95, 62.5,
107.5, 70, 95, 80, 105, 85, 90, 100, 97.5, 105, 82.5, 125, 92.5, 122.5, 105, 110, 110, 100,
112.5, 115, 117.5, 122.5, 105, 127.5, 90, 132.5, 80, 135, 90, 137.5, 100, 135, 115, 130,
112.5, 140, 117.5, 147.5, 95, 147.5, 75, 140, 85, 150, 95, 155, 115, 157.5, 100, 172.5,
110, 180, 120, 195, 125, 205, 127.5, 215, 127.5, 235, 122.5, 255, 115, 275, 105, 290, 90, 300,
75, 305, 60, 300, 50, 295, 40, 282.5, 37.5, 265, 39, 255, 45, 240, 55, 232.5, 65, 230, 75, 235,
80, 240, 80, 250, 70, 260, 60, 262.5, 57.5, 250, 60, 245, 65, 245, 62.5, 250, 65, 255, 75, 250,
75, 242.5, 65, 237.5, 55, 240, 50, 245, 46.5, 255, 45, 265, 47.5, 275, 55, 285, 65, 287.5,
75, 287.5, 85, 282.5, 92.5, 275, 97.5, 265, 100, 255, 102.5, 245, 102.5, 235, 100, 225, 95, 215,
85, 205, 75, 197.5, 65, 192.5, 55, 182.5, 47.5, 175, 40, 165, 32.5, 155, 30, 145, 30, 120, 35, 110,
45, 100, 55, 90, 65, 80, 71, 71, 75, 60, 70, 55, 60, 60, 50, 65, 40, 67.5, 35, 65]
for i in range(0, len(c)):
c[i] = c[i] + 20
figura.create_polygon(c, fill="green", outline="black", width=2)
botonVentanaHija = Button(ventana, text="Cerrar (Carlos Guzman Rubio)", command=lambda: ejecutar(ventana.destroy()))
botonVentanaHija.pack()
def mario():
ventana = ventanaH()
ventana.deiconify()
figura = Canvas(ventana)
figura.config(width=300, height=200, bg='white')
figura.pack(expand=YES, fill=BOTH)
figura.create_polygon(50, 20, 100, 20, 100, 30, 130, 30, 130, 40, 110, 40, 110, 50, 130, 50, 130, 60, 140, 60, 140,
70, 130, 70, 130, 80, 120, 80, 120, 90, 100, 90, 100, 100, 130, 100, 130, 110, 140, 110, 140,
150, 120, 150, 120, 160, 130, 160, 130, 170, 140, 170, 140, 180, 100, 180, 100, 160, 90, 160,
90, 150, 70, 150, 70, 160, 60, 160, 60, 180, 20, 180, 20, 170, 30, 170, 30, 160, 40, 160, 40,
150, 20, 150, 20, 110, 30, 110, 30, 100, 40, 100, 40, 90, 50, 90, 50, 80, 30, 80, 30, 50, 40,
50, 40, 30, 50, 30, fill="red", outline='white')
botonVentanaHija = Button(ventana, text="Cerrar (Jonathan Guzman Jaramillo)", command=lambda: ejecutar(ventana.destroy()))
botonVentanaHija.pack()
def invader():
ventana = ventanaH()
ventana.deiconify()
figura = Canvas(ventana)
figura.config(width=800, height=500, bg='white')
figura.pack(expand=YES, fill=BOTH)
figura.create_polygon(250, 50, 200, 50, 200, 100, 250, 100, 250, 150, 200, 150, 200,
200, 150, 200, 150, 250, 100, 250, 100, 400, 150, 400, 150, 300,
200, 300, 200, 450, 350, 450, 350, 400, 250, 400, 250, 350, 500, 350,
500, 400, 400, 400, 400, 450, 550, 450, 550, 300, 600, 300, 600, 400,
650, 400, 650, 250, 600, 250, 600, 200, 550, 200, 550, 150, 500, 150, 500,
100, 550, 100, 550, 50, 450, 50, 450, 150, 300, 150, 300, 50, fill="black",
outline="lightblue", width=6)
figura.create_polygon(250, 200, 250, 250, 300, 250, 300, 200, fill="white", outline="white", width=6)
figura.create_polygon(500, 200, 450, 200, 450, 250, 500, 250, fill="white", outline="white", width=6)
botonVentanaHija = Button(ventana, text="Cerrar (Pedro Escoto Aguirre)", command=lambda: ejecutar(ventana.destroy()))
botonVentanaHija.pack()
#Lista de etiquetas de la ventana principal
etiquetaT1 = Label(ventanaPrincipal, text="Figuras realizadas en clase", bg="orange", font="Arial 12 bold",pady=10)
etiquetaT1.grid(row=1, column=1, columnspan=9)
etiquetaT2 = Label(ventanaPrincipal, text="Figuras realizadas por compañeros de clase", bg="orange", font="Arial 12 bold",pady=10)
etiquetaT2.grid(row=3, column=1, columnspan=9)
#Lista de botones de la ventana principal
botonCirculo = Button(ventanaPrincipal, text="Mostrar círculo", command=lambda: ejecutar (circulo()))
botonCirculo.grid (row=2, column=1,sticky="W,E")
botonRectangulo = Button(ventanaPrincipal, text="Mostrar rectángulo", command=lambda: ejecutar (rectangulo()))
botonRectangulo.grid (row=2, column=2,sticky="W,E")
botonLineas = Button(ventanaPrincipal, text="Mostrar línea", command=lambda: ejecutar (lineas()))
botonLineas.grid (row=2, column=3,sticky="W,E")
botonQuesito = Button(ventanaPrincipal, text="Mostrar quesito", command=lambda: ejecutar (quesito()))
botonQuesito.grid (row=2, column=4,sticky="W,E")
botonArco = Button(ventanaPrincipal, text="Mostrar arco", command=lambda: ejecutar (arco()))
botonArco.grid (row=2, column=5,sticky="W,E")
botonPastel = Button(ventanaPrincipal, text="Mostrar pastel", command=lambda: ejecutar (pastel()))
botonPastel.grid (row=2, column=6,sticky="W,E")
botonTexto = Button(ventanaPrincipal, text="Mostrar texto", command=lambda: ejecutar (texto()))
botonTexto.grid (row=2, column=7,sticky="W,E")
botonPoligono = Button(ventanaPrincipal, text="Mostrar polígono", command=lambda: ejecutar (poligono()))
botonPoligono.grid (row=2, column=8,sticky="W,E")
botonPoligono = Button(ventanaPrincipal, text="Mostrar letras", command=lambda: ejecutar (letras()))
botonPoligono.grid (row=2, column=9,sticky="W,E")
botonEstrella = Button(ventanaPrincipal, text="Mostrar estrella", command=lambda: ejecutar (estrella()))
botonEstrella.grid (row=4, column=1,sticky="W,E")
botonGato = Button(ventanaPrincipal, text="Mostrar gatito", command=lambda: ejecutar (gatito()))
botonGato.grid (row=4, column=2,sticky="W,E")
botonPerro = Button(ventanaPrincipal, text="Mostrar perrito", command=lambda: ejecutar (perrito()))
botonPerro.grid (row=4, column=3,sticky="W,E")
botonAntilope = Button(ventanaPrincipal, text="Mostrar antílope", command=lambda: ejecutar (antilope()))
botonAntilope.grid (row=4, column=4,sticky="W,E")
botonConejo = Button(ventanaPrincipal, text="Mostrar conejo", command=lambda: ejecutar (conejo()))
botonConejo.grid (row=4, column=5,sticky="W,E")
botonManzana = Button(ventanaPrincipal, text="Mostrar manzana", command=lambda: ejecutar (manzana()))
botonManzana.grid (row=4, column=6,sticky="W,E")
botonMonito = Button(ventanaPrincipal, text="Mostrar monito", command=lambda: ejecutar (monito()))
botonMonito.grid (row=4, column=7,sticky="W,E")
botonFacebook = Button(ventanaPrincipal, text="Mostrar facebook", command=lambda: ejecutar (facebook()))
botonFacebook.grid (row=4, column=8,sticky="W,E")
botonCorazon = Button(ventanaPrincipal, text="Mostrar corazon", command=lambda: ejecutar (corazon()))
botonCorazon.grid (row=4, column=9,sticky="W,E")
botonTrifuerza = Button(ventanaPrincipal, text="Mostrar trifuerza", command=lambda: ejecutar (megatrifuerza()))
botonTrifuerza.grid (row=5, column=1,sticky="W,E")
botonHipocampo = Button(ventanaPrincipal, text="Mostrar hipocampo", command=lambda: ejecutar (hipocampo()))
botonHipocampo.grid (row=5, column=2,sticky="W,E")
botonMario = Button(ventanaPrincipal, text="Mostrar mario", command=lambda: ejecutar (mario()))
botonMario.grid (row=5, column=3,sticky="W,E")
botonInvader = Button(ventanaPrincipal, text="Mostrar invader", command=lambda: ejecutar (invader()))
botonInvader.grid (row=5, column=4,sticky="W,E")
ventanaPrincipal.mainloop()
Suscribirse a:
Entradas (Atom)