Programa - Menú de Poligonos | Alberto Vega



#!/usr/bin/env python
# -*- coding: utf-8 -*-
from Tkinter import *

def Mario():
    v1 = Toplevel(v0)
    v1.title("Alberto Vega")
    #v1.config(bg="dimgrey")
    v1.geometry("150x180")

    canvas = Canvas(v1, width=390, height=350, bg='dimgrey')
    canvas.pack(expand=YES, fill=BOTH)

    canvas.create_polygon(40, 10, 90, 10, 90, 20, 120, 20, 120, 30, 30, 30, 30, 20, 40, 20, width=2, fill="RED", outline="BLACK")
    canvas.create_polygon(30, 30, 100, 30, 100, 40, 120, 40, 120, 50, 130, 50, 130, 60, 120, 60, 120, 70, 110, 70, 110, 80, 40, 80,
                          40, 70, 20, 70, 20, 40, 30, 40, width=2, fill="DARKORANGE", outline="BLACK")
    canvas.create_polygon(30, 80, 90, 80, 90, 90, 120, 90, 120, 100, 130, 100, 130, 110, 110, 110, 110, 120, 100, 120, 100, 130,
                          110, 130, 110, 150, 80, 150, 80, 140, 60, 140, 60, 150, 30, 150, 30, 130, 40, 130, 40, 120, 30, 120, 30, 110,
                          10, 110, 10, 100, 20, 100, 20, 90, 30, 90, width=2, fill="SaddleBROWN", outline="BLACK")
    canvas.create_polygon(50, 80, 60, 80, 60, 100, 80, 100, 80, 90, 90, 90, 90, 110, 100, 110, 100, 130, 110, 130,
                          110, 150, 80, 150, 80, 140, 60, 140, 60, 150, 30, 150, 30, 130, 40, 130, 40, 110, 50, 110,
                          width=2, fill="RED", outline="BLACK")
    canvas.create_polygon(10, 110, 30, 110, 30, 120, 40, 120, 40, 130, 30, 130,
                          30, 140, 10, 140, width=2, fill="orange", outline="BLACK")
    canvas.create_polygon(130, 110, 130, 140, 110, 140, 110, 130, 100, 130,
                          100, 120, 110, 120, 110, 110, width=2, fill="orange", outline="BLACK")
    canvas.create_polygon(50, 150, 50, 170, 10, 170, 10, 160,
                          20, 160, 20, 150, width=2, fill="saddlebrown", outline="BLACK")
    canvas.create_polygon(100, 150, 100, 170, 140, 170, 140, 160,
                          130, 160, 130, 150, width=2, fill="saddlebrown", outline="BLACK")
    canvas.create_rectangle(80, 110, 90, 120, width=2, fill="yellow", outline="BLACK")
    canvas.create_rectangle(50, 110, 60, 120, width=2, fill="yellow", outline="BLACK")
    canvas.create_polygon(80, 70, 120, 70, 120, 60, 100, 60, 100, 50, 90, 50, 90, 30, 80, 30, 80, 50, 90, 50, 90, 60,
                          80, 60, width=2, fill="saddlebrown", outline="black")
    canvas.create_polygon(30, 40, 20, 40, 20, 70, 40, 70, 40, 60, 30, 60, 30, 30, 60, 30, 60, 40, 50, 40, 50, 50, 60, 50,
                          60, 60, 40, 60, 40, 40, width=2, fill="saddlebrown", outline="black")
    v1.deiconify()
def Diamante():
    v1 = Toplevel(v0)
    v1.title("Pedro Maldonado")
    #v1.config(bg="dimgrey")
    v1.geometry("350x350")

    canvas = Canvas(v1, width=300, height=200, bg='white')
    canvas.pack(expand=YES, fill=BOTH)

    canvas.create_polygon(100, 50, 250, 50, 300, 100, 175, 225, 50, 100, 100, 50, width=3, fill='yellow', outline='black')

    v1.deiconify()
def Tren():
    v1 = Toplevel(v0)
    v1.title("Humberto Perez")
    #v1.config(bg="black")
    v1.geometry("350x350")

    canvas = Canvas(v1, width=300, height=300, bg='light blue')
    canvas.pack(expand=YES, fill=BOTH)

    canvas.create_polygon(20, 20, 20, 40, 50, 40, 50, 70, 30, 70, 30, 80, 20, 80, 20, 100, 50, 100, 80, 90, 100, 90, 110, 100, 130, 100,
                         140, 90, 160, 90, 170, 100, 180, 100, 180, 110, 200, 110, 190, 100, 190, 60, 200, 60, 200, 50, 150, 50, 150, 40,
                         160, 40, 160, 30, 130, 30, 130, 40, 140, 40, 140, 50, 100, 50, 100, 20, fill='brown', outline='white')
    canvas.create_oval(60, 90, 110, 120, fill='black', outline='black')
    canvas.create_oval(120, 90, 170, 120, fill='black', outline='black')
    canvas.create_rectangle(60, 40, 80, 60, fill='black', outline='black')
    canvas.create_oval(140, 10, 150, 20, fill='black', outline='black')
    canvas.create_oval(120, 10, 130, 20, fill='black', outline='black')
    canvas.create_oval(110, 10, 120, 20, fill='black', outline='black')

    v1.deiconify()

v0 = Tk()
menu1 = Menu(v0)
v0.title("Poligonos Alberto Vega")
v0.config(menu=menu1,bg="Dimgrey")
v0.geometry("500x500")

menu1_1 = Menu(menu1, tearoff=0)
menu1.add_cascade(label="Alberto Vega", menu=menu1_1)

menu1_1_1 = Menu(menu1_1, tearoff=0)
menu1_1.add_cascade(label="Mis Poligonos", menu=menu1_1_1)
menu1_1_1.add_command(label="Mario Bros", command=lambda: Mario())

menu1_2 = Menu(menu1, tearoff=0)
menu1.add_cascade(label="Compañeros", menu=menu1_2)

menu1_2_1 = Menu(menu1_2, tearoff=0)
menu1_2.add_cascade(label="Pedro Maldonado", menu=menu1_2_1)
menu1_2_1.add_command(label="Diamante", command=lambda: Diamante())

menu1_2_1 = Menu(menu1_2, tearoff=0)
menu1_2.add_cascade(label="Humberto Perez", menu=menu1_2_1)
menu1_2_1.add_command(label="Tren", command=lambda: Tren())

v0.mainloop()