lunes, 18 de septiembre de 2017

Programa de diferentes figuras

from Tkinter import *
ventanaprin = Tk()
ventanaprin.config(
bg="lightblue")
ventanaprin.geometry(
"500x500")
ventanaprin.title(
"Ventana")
ventacir = Toplevel(ventanaprin)
ventacir.protocol(
"WM_DELETE_WINDOW", "onexit")

ventarec = Toplevel(ventanaprin)
ventarec.protocol(
"WM_DELETE_WINDOW", "onexit")

ventalin = Toplevel(ventanaprin)
ventalin.protocol(
"WM_DELETE_WINDOW", "onexit")

ventarc = Toplevel(ventanaprin)
ventarc.protocol(
"WM_DELETE_WINDOW", "onexit")

ventaqueso = Toplevel(ventanaprin)
ventaqueso.protocol(
"WM_DELETE_WINDOW", "onexit")

venarcque = Toplevel(ventanaprin)
venarcque.protocol(
"WM_DELETE_WINDOW", "onexit")

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

def ejecutar2(f):
 ventarec.after(
200, f)

def ejecutar3(f):
 ventalin.after(
200, f)

def ejecutar4(f):
 ventarc.after(
200, f)

def ejecutar5(f):
 ventaqueso.after(
200, f)

def ejecutar6(f):
 venarcque.after(
200,f)

def mostrar(ventana):
 ventana.deiconify()

def circulo(ven):
 circulo = Canvas(ventacir,
width=210, height=210, bg="lightblue")
 circulo.pack(
expand=YES, fill=BOTH)
 circulo.create_oval(
10, 10, 200, 200, width=3, fill='pink')
 ventacir.deiconify()

def rectangulo(ven):
 rectangulo = Canvas(ventarec,
width=210, height=210, bg="pink")
 rectangulo.pack(
expand=YES, fill=BOTH)
 rectangulo.create_rectangle(
10, 10, 200, 200, width=3, fill='orange')
 ventarec.deiconify()

def linea(ven):
 linea = Canvas(ventalin,
width=210, height=210, bg="white")
 linea.pack(
expand=YES, fill=BOTH)
 linea.create_line(
5, 5, 200, 200, width=10, fill='purple')
 ventalin.deiconify()


def arco(ven):
 canvas = Canvas(ventarc,
width=300, height=200, bg='white')
 canvas.pack(
expand=YES, fill=BOTH)
 canvas.create_arc(
10, 10, 190, 190, start=0, extent=270, fill='orange')
 ventarc.deiconify()

def quesito(ven):
 canvas = Canvas(ventaqueso,
width=300, height=200, bg='white')
 canvas.pack(
expand=YES, fill=BOTH)
 canvas.create_arc(
10, 10, 190, 190, start=270, extent=90, fill='gold')
 ventaqueso.deiconify()

def arcoque (ven):
    canvas = Canvas(venarcque,
width=300, height=200, bg='white')
    canvas.pack(
expand=YES, fill=BOTH)
    canvas.create_arc(
10, 10, 190, 190, start=0, extent=270, fill='gold')
    canvas.create_arc(
10, 10, 190, 190, start=270, extent=90, fill='orange')
    venarcque.deiconify()


def ocultar(ventana):
 ventacir.withdraw()
 ventarec.withdraw()
 ventalin.withdraw()
 ventarc.withdraw()
 ventaqueso.withdraw()
 venarcque.withdraw()

cerra1= Button(ventacir,
text="CERRAR", command=lambda: ejecutar(ocultar(ventacir)))
cerra1.pack()
cerrar2= Button(ventarec,
text="CERRAR", command=lambda: ejecutar2(ocultar(ventarec)))
cerrar2.pack()
cerrar3= Button(ventalin,
text="CERRAR", command=lambda: ejecutar3(ocultar(ventalin)))
cerrar3.pack()
cerrar4= Button(ventarc,
text="CERRAR", command=lambda: ejecutar4(ocultar(ventarc)))
cerrar4.pack()
cerrar5= Button(ventaqueso,
text="CERRAR", command=lambda: ejecutar5(ocultar(ventaqueso)))
cerrar5.pack()
cerrar6= Button(venarcque,
text="CERRAR", command=lambda: ejecutar6(ocultar(venarcque)))
cerrar6.pack()

botoncir = Button(ventanaprin,
text="CIRCULO", command=lambda: ejecutar (circulo(ventanaprin)))
botoncir.grid(
row=1, column=1)
botonrec = Button(ventanaprin,
text="RECTANGULO", command=lambda: ejecutar (rectangulo(ventanaprin)))
botonrec.grid(
row=1, column=2)
botonlin = Button(ventanaprin,
text="LINEA", command=lambda: ejecutar (linea(ventanaprin)))
botonlin.grid(
row=1, column=3)
botonque = Button(ventanaprin,
text="QUESITO", command=lambda: ejecutar (quesito(ventanaprin)))
botonque.grid(
row=1, column=4)
botonarc = Button(ventanaprin,
text="ARCO", command=lambda: ejecutar (arco(ventanaprin)))
botonarc.grid(
row=1, column=5)
botonarcque = Button(ventanaprin,
text="ARCO Y QUESITO ", command=lambda: ejecutar (arcoque(ventanaprin)))
botonarcque.grid(
row=1, column=6)

ventacir.withdraw()
ventarec.withdraw()
ventalin.withdraw()
ventarc.withdraw()
ventaqueso.withdraw()
venarcque.withdraw()
ventanaprin.mainloop()





No hay comentarios.:

Publicar un comentario

Conclusión   del equipo #1: Puertos paralelos  Un puerto paralelo es una interfaz entre un ordenador y un periférico. El puerto paralelo ...