from
Tkinter import *
v0 = Tk()
v1 =
Toplevel(v0)
v2 =
Toplevel(v0)
v3 =
Toplevel(v0)
v4 =
Toplevel(v0)
v5 =
Toplevel(v0)
v6 =
Toplevel(v0)
v7 =
Toplevel(v0)
v8 =
Toplevel(v0)
v9 =
Toplevel(v0)
v0.title("Figuras")
v1.title("Circulo")
v2.title("Rectangulo")
v3.title("Lineas")
v4.title("quesito")
v5.title("arco")
v6.title("quesito y arco")
v7.title("texto")
v8.title("poligono")
v9.title("figura")
v1.protocol("WM_DELETE_WINDOW",
"onexit")
v2.protocol("WM_DELETE_WINDOW",
"onexit")
v3.protocol("WM_DELETE_WINDOW",
"onexit")
v4.protocol("WM_DELETE_WINDOW",
"onexit")
v5.protocol("WM_DELETE_WINDOW",
"onexit")
v6.protocol("WM_DELETE_WINDOW",
"onexit")
v7.protocol("WM_DELETE_WINDOW",
"onexit")
v8.protocol("WM_DELETE_WINDOW",
"onexit")
v9.protocol("WM_DELETE_WINDOW",
"onexit")
def mostrar(ventana): ventana.deiconify()
def ocultar(ventana): ventana.withdraw()
def
ejecutar(f): v0.after(200, f)
v0.config(bg="blue")
v0.geometry("750x300")
def circulo(ventana):
v1.deiconify()
circulo = Canvas(v1, width=210, height=210,
bg="blue")
circulo.pack()
cuadro = circulo.create_oval(10, 10, 200,
200, width=3, fill="red")
def rectangulo(ventana):
v2.deiconify()
rectangulo = Canvas(v2, width=210, height=210,
bg="white")
rectangulo.pack(expand=YES, fill=BOTH)
rectangulo.create_rectangle(10, 10, 200,
200, width=3, fill='yellow')
def
lineas(ventana):
v3.deiconify()
linea = Canvas(v3, width=210, height=210,
bg='white')
linea.pack(expand=YES, fill=BOTH)
linea.create_line(0, 200, 200, 0, width=10,
fill='black', )
linea.create_line(0, 0, 200, 200, width=10,
fill='black', )
def quesito(ventana):
v4.deiconify()
queso = Canvas(v4, width=300, height=200,
bg='white')
queso.pack(expand=YES, fill=BOTH)
queso.create_arc(10, 10, 190, 190,
start=270, extent=90, fill='gray90')
def arco(ventana):
v5.deiconify()
arco = Canvas(v5, width =300, height=200,
bg='white')
arco.pack(expand=YES, fill=BOTH)
xy = 10, 10, 190, 190
arco.create_arc(xy, start=0, extent=270,
fill='gray60')
def quesitoyarco(ventana):
v6.deiconify()
quesitoyarco = Canvas(v6, width=300,
height=200, bg='white')
quesitoyarco.pack(expand=YES, fill=BOTH)
quesitoyarco.create_arc(20, 20, 200, 200,
start=270, extent=90, fill='gray90')
quesitoyarco.pack(expand=YES, fill=BOTH)
xy = 10, 10, 190, 190
quesitoyarco.create_arc(xy, start=0,
extent=270, fill='gray60')
def texto(ventana):
v7.deiconify()
texto = Canvas(v7, width=300, height=200,
bg='red')
texto.pack(expand=YES, fill=BOTH)
# texto.create_text(20, 20, 200, 200,
start=270, extent=90, fill='gray90')
texto.create_text(150,70,
fill="darkblue", font="bold",
text="JUAN\nRODOLFO\nGARCIA")
def poligono(ventana):
v8.deiconify()
poligono = Canvas(v8, width=300, height=200,
bg='yellow')
poligono.create_polygon(40, 40, 40, 140,
140, 140, 140, 100, fill="lightblue", outline="brown",
width=6)
poligono.pack(expand=YES, fill=BOTH)
def poligono2(ventana):
v9.deiconify()
poligono2 = Canvas(v9, width=300, height=200,
bg='yellow')
poligono2.create_polygon(40, 20, 20, 140,
150, 10, 120, 100, fill="lightblue", outline="brown",
width=6)
poligono2.pack(expand=YES, fill=BOTH)
boton2 =
Button(v1, text="Cerrar", relief=SOLID, bg='blue', command=lambda:
ejecutar(ocultar(v1)))
boton2.pack()
boton5 =
Button(v2, text="Cerrar", relief=SOLID, bg='green', command=lambda:
ejecutar(ocultar(v2)))
boton5.pack()
boton2 =
Button(v3, text="Cerrar", relief=SOLID, bg='red', command=lambda:
ejecutar(ocultar(v3)))
boton2.pack()
boton2 =
Button(v4, text="Cerrar", relief=SOLID, bg='red', command=lambda:
ejecutar(ocultar(v4)))
boton2.pack()
boton2 =
Button(v5, text="Cerrar", relief=SOLID, bg='red', command=lambda:
ejecutar(ocultar(v5)))
boton2.pack()
boton2 =
Button(v6, text="Cerrar", relief=SOLID, bg='red', command=lambda:
ejecutar(ocultar(v6)))
boton2.pack()
boton2 =
Button(v7, text="Cerrar", relief=SOLID, bg='red', command=lambda:
ejecutar(ocultar(v7)))
boton2.pack()
boton2 =
Button(v8, text="Cerrar", relief=SOLID, bg='red', command=lambda:
ejecutar(ocultar(v8)))
boton2.pack()
boton2 =
Button(v9, text="Cerrar", relief=SOLID, bg='red', command=lambda:
ejecutar(ocultar(v9)))
boton2.pack()
b1 =
Button(v0, text="Mostrar circulo", relief=FLAT, bg='white',
command=lambda: ejecutar(circulo(v1)))
b1.grid(row=1,
column=3)
b2 =
Button(v0, text="Mostrar rectangulo", relief=FLAT,
bg='white',command=lambda: ejecutar(rectangulo(v0)))
b2.grid(row=1,
column=2)
b3 =
Button(v0, text="Mostrar lineas", relief=FLAT, bg='white',
command=lambda: ejecutar(lineas(v0)))
b3.grid(row=1,
column=1)
b4 =
Button(v0, text="Mostrar quesito", relief=FLAT, bg='white',
command=lambda: ejecutar(quesito(v4)))
b4.grid(row=1,
column=4)
b5 =
Button(v0, text="Mostrar arco", relief=FLAT, bg='white',
command=lambda: ejecutar(arco(v5)))
b5.grid(row=1,
column=5)
b6 =
Button(v0, text="Mostrar quesito y arco", relief=FLAT, bg='white',
command=lambda: ejecutar(quesitoyarco(v6)))
b6.grid(row=1,
column=6)
b7 =
Button(v0, text="nombre", relief=FLAT, bg='white', command=lambda:
ejecutar(texto(v7)))
b7.grid(row=1,
column=7)
b8 =
Button(v0, text="poligono", relief=FLAT, bg='white', command=lambda:
ejecutar(poligono(v8)))
b8.grid(row=1,
column=8)
b9 =
Button(v0, text="figura", relief=FLAT, bg='white', command=lambda:
ejecutar(poligono2(v9)))
b9.grid(row=1,
column=9)
v9.withdraw()
v8.withdraw()
v7.withdraw()
v6.withdraw()
v5.withdraw()
v4.withdraw()
v3.withdraw()
v2.withdraw()
v1.withdraw()
v0.mainloop()




No hay comentarios:
Publicar un comentario