Polígonos Grupo A Semestre Enero-Junio 2019

       


from Tkinter import *


def mostrar(num):
    v1 = Toplevel(v0)
    v1.title('Ventana hija')
    v1.protocol('WM_DELETE_WINDOW', 'onexit')
    v1.config(bg='blue')
    v1.geometry('800x500')

    if num == 1:
        hola = Canvas(v1, width=500, height=800, bg='white')
        hola.pack(expand=YES, fill=BOTH)
        hola.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)
        b6 = Button(hola, text='Ocultar', command=lambda: ejecutar(Ocultar(v1)))
        b6.grid(row=1, column=3)

    elif num == 2:
        hola = Canvas(v1, width=500, height=500, bg='white')
        hola.pack(expand=YES, fill=BOTH)
        hola.create_polygon(400, 50, 350, 150, 400, 250, 450, 150, fill="red", outline="red", width=6)
        hola.create_polygon(400, 250, 300, 250, 250, 350, 350, 350, fill="red", outline="red", width=6)
        hola.create_polygon(400, 250, 450, 350, 550, 350, 500, 250, fill="red", outline="red", width=6)
        b3 = Button(hola, text='Ocultar', command=lambda: ejecutar(Ocultar(v1)))
        b3.grid(row=1, column=3)


    elif num == 3:
        hola = Canvas(v1, width=300, height=210, bg="black")
        hola.pack(expand=YES, fill=BOTH)
        hola.create_polygon(130, 420, 130, 100, 200, 100, 200, 420,
                            400, 420, 400, 100, 470, 100, 470, 420,
                            130, 420, 400, 100, 200, 100, 470, 420,
                            400, 420, 130, 100, 470, 100, 200, 420,
                            fill="white")
        b3 = Button(hola, text='ocultar', command=lambda: ejecutar(Ocultar(v1)))
        b3.grid(row=1, column=3)

    elif num == 4:
        hola = Canvas(v1, width=500, height=500, bg="skyblue")
        hola.pack(expand=YES, fill=BOTH)
        # flor
        hola.create_polygon(140, 100, 180, 130, 220, 100, 260, 130, 300, 100, 300, 180, 260, 220,
                            180, 220, 140, 180,
                            width=2, fill="red", outline="darkred")
        # tallo
        hola.create_rectangle(215, 220, 225, 410, width=2, fill="forestgreen", outline="darkgreen")
        # hojas
        hola.create_polygon(80, 250, 170, 260, 215, 320, 140, 310, width=2, fill="forestgreen", outline="darkgreen")
        hola.create_polygon(225, 320, 275, 260, 365, 250, 305, 310, width=2, fill="forestgreen", outline="darkgreen")
        # maceta
        hola.create_polygon(120, 390, 320, 390, 280, 490, 160, 490, width=2, fill="sienna", outline="black")
        b4 = Button(hola, text='ocultar', command=lambda: ejecutar(Ocultar(v1)))
        b4.grid(row=1, column=3)
    elif num == 5:
        hola = Canvas(v1, width=550, height=600, bg="BLACK")
        hola.pack(expand=YES, fill=BOTH)
        # cuerpo pacman
        hola.create_arc(80, 200, 180, 300, extent=290, style=PIESLICE, start=40, width=2, fill="YELLOW",
                        outline="gold")
        # ojos
        hola.create_arc(120, 215, 145, 240, extent=320, style=PIESLICE, start=220, width=2, fill="black",
                        outline="white")
        # camino
        hola.create_rectangle(5, 10, 300, 40, width=5, fill='black', outline="red")
        hola.create_rectangle(5, 160, 400, 190, width=5, fill='black', outline="red")
        hola.create_rectangle(440, 5, 480, 35, width=5, fill='black', outline="red")

        hola.create_rectangle(30, 340, 60, 600, width=5, fill='black', outline="red")
        hola.create_rectangle(200, 360, 260, 390, width=5, fill='black', outline="red")
        hola.create_rectangle(515, 210, 545, 300, width=5, fill='black', outline="red")
        hola.create_polygon(210, 500, 210, 530, 400, 530, 400, 310, 370, 310, 370, 500, width=5, fill="black",
                            outline="red")

        # enemigo fantasma
        hola.create_polygon(460, 530, 480, 510, 520, 510, 540, 530, 540, 590, 530, 570, 515, 590,
                            500, 570, 485, 590, 470, 570, 460, 590, 460, 530, width=3, fill='salmon', outline="pink")
        # ojos
        hola.create_oval(475, 530, 495, 550, width=2, fill="white", outline="salmon")
        hola.create_oval(505, 530, 525, 550, width=2, fill="white", outline="salmon")

        # pupila
        hola.create_oval(477, 534, 487, 546, width=1, fill="midnightblue", outline="navy")
        hola.create_oval(507, 534, 517, 546, width=1, fill="midnightblue", outline="navy")
        b5 = Button(hola, text='ocultar', command=lambda: ejecutar(Ocultar(v1)))
        b5.grid(row=1, column=3)

    elif num == 6:
        hola = Canvas(v1, width=700, height=550, bg="black")
        hola.pack(expand=YES, fill=BOTH)
        # cuerpo coordenadas
        hola.create_polygon(100, 100, 420, 100, 500, 180, 500, 220, 460, 260, 460, 400, 500, 430,
                            500, 460, 460, 460, 420, 420, 420, 340, 380, 300, 340, 340, 340, 460,
                            260, 460, 260, 340, 260, 460, 180, 460, 180, 340, 180, 460, 140, 460,
                            140, 340, 140, 460, 80, 460, 40, 340, 40, 200, 20, 280, 13, 280, 35, 195,
                            width=4, fill="gray", outline="black")
        # cuernos forma triangular
        hola.create_polygon(350, 275, 445, 298, 350, 298, width=2, fill="white", outline="dimgray")
        hola.create_polygon(460, 275, 550, 298, 460, 298, width=2, fill="white", outline="dimgray")
        # orejas octagono
        hola.create_polygon(260, 100, 300, 100, 340, 140, 340, 220, 300, 260, 260, 260,
                            220, 220, 220, 140, width=2, fill="gray", outline="dimgray")
        hola.create_polygon(460, 140, 500, 100, 540, 100, 580, 140, 580, 220, 540, 260,
                            500, 260, 470, 250, 500, 220, 500, 180, width=2, fill="gray", outline="dimgray")
        # ojos ovalo
        hola.create_oval(390, 230, 410, 260, width=1, fill="black", outline="black")
        b6 = Button(hola, text='ocultar', command=lambda: ejecutar(Ocultar(v1)))
        b6.grid(row=1, column=3)

    elif num == 7:
        hola = Canvas(v1, width=800, height=800, bg='white')
        hola = Canvas(v1, width=210, height=210, bg='pink')
        hola.pack(expand=YES, fill=BOTH)
        hola.create_polygon(382.6, 54.5,
                            339.07, 56.3,
                            311.48, 99.02,
                            284.55, 99.02,
                            284.78, 141.74,
                            334.62, 141.74,
                            336.4, 180.91,
                            313.26, 212.95,
                            339.96, 240.54,
                            338.18, 212.06,
                            375.56, 254.78,
                            355, 286,
                            384.46, 302.84,
                            454.78, 303.73,
                            456.56, 210.28,
                            347.97, 113.26,
                            340.85, 97.24, fill="white", outline="black", width=6)

        b7 = Button(hola, text='Ocultar', command=lambda: ejecutar(Ocultar(v1)))
        b7.grid(row=1, column=3)

    elif num == 8:
        hola = Canvas(v1, width=800, height=800, bg='white')
        hola.pack(expand=YES, fill=BOTH)
        hola.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)
        hola.create_polygon(250, 200, 250, 250, 300, 250, 300, 200, fill="white", outline="white", width=6)
        hola.create_polygon(500, 200, 450, 200, 450, 250, 500, 250, fill="white", outline="white", width=6)

        b8 = Button(hola, text='Ocultar', command=lambda: ejecutar(Ocultar(v1)))
        b8.grid(row=1, column=3)

    elif num == 9:
        hola = Canvas(v1, width=300, height=210, bg="white")
        hola.pack(expand=YES, fill=BOTH)
        hola.create_polygon(100, 150, 300, 450, 500, 150, 380, 150, 380, 120, 360, 120,
                            360, 150, 310, 150, 310, 90, 290, 90, 290, 150, 240, 150, 240, 120,
                            220, 120, 220, 150, fill="black")
        hola.create_polygon(160, 180, 300, 400, 440, 180, 380, 180, 380, 210,
                            360, 210, 360, 180, 310, 180, 310, 240, 290, 240,
                            290, 180, 240, 180, 240, 210, 220, 210, 220, 180, fill="white")
        b9 = Button(hola, text='ocultar', command=lambda: ejecutar(Ocultar(v1)))
        b9.grid(row=1, column=3)


def Ocultar(ventana):
    ventana.destroy()


def ejecutar(f):
    v0.after(200, f)


v0 = Tk()  # Este es mi objeto ventana
v0.title('Ventana Madre')
v0.config(bg='black')
v0.geometry('500x500')

b1 = Button(v0, text='Figura Daniel Luna', command=lambda: ejecutar(mostrar(1)))
b1.grid(row=1, column=10)

b2 = Button(v0, text='Figura Luis Rincon', command=lambda: ejecutar(mostrar(2)))
b2.grid(row=4, column=10)

b3 = Button(v0, text='Figura Nadia Rodriguez', command=lambda: ejecutar(mostrar(3)))
b3.grid(row=6, column=10)

b4 = Button(v0, text='Figura Wendy Lopez', command=lambda: ejecutar(mostrar(4)))
b4.grid(row=8, column=10)

b5 = Button(v0, text='Figura Wendy Lopez2', command=lambda: ejecutar(mostrar(5)))
b5.grid(row=10, column=10)

b6 = Button(v0, text='Figura Wendy Lopez3', command=lambda: ejecutar(mostrar(6)))
b6.grid(row=12, column=10)

b7 = Button(v0, text='Figura Gustavo Vazquez', command=lambda: ejecutar(mostrar(7)))
b7.grid(row=14, column=10)

b8 = Button(v0, text='Figura Hector Campos', command=lambda: ejecutar(mostrar(8)))
b8.grid(row=16, column=10)

b9 = Button(v0, text='Figura Jesuss Escobar', command=lambda: ejecutar(mostrar(9)))
b9.grid(row=18, column=10)

v0 = mainloop()

Comentarios

Entradas populares de este blog

Registros del lenguaje ensamblador

Ventajas y desventajas de lenguaje ensamblador

Unidad 4 Administración de Base de Datos