# -*- coding: utf-8 -*-from Tkinter import * VentanaPrincipal= Tk() VentanaPrincipal.title("Ventana Principal") VentanaPrincipal.config(bg="gold") VentanaPrincipal.geometry("500x500") def ocultar(ventana):ventana.destroy() def ejecutar(f): VentanaPrincipal.after(200, f) def mostrarcirculo(): Vhija= Toplevel(VentanaPrincipal) Vhija.title("CIRCULO") Vhija.protocol("WM_DELETE_WINDOW", "onexit") Vhija.config(bg="black") Vhija.geometry("500x500") Circulo= Canvas(Vhija,width=300, height=210, bg='blue') Circulo.pack(expand=YES, fill=BOTH) Circulo.create_oval(10, 10, 400, 400, width=5, fill='White') BotonCirculo1= Button(Circulo, text="ocultar ventana", command=lambda: ejecutar(ocultar(Vhija))) BotonCirculo1.grid(row=1, column=3) Vhija.deiconify() def mostrarrectangulo(): Vhija2= Toplevel(VentanaPrincipal) Vhija2.title("RECTANGULO") Vhija2.protocol("WM_DELETE_WINDOW", "onexit") Vhija2.config(bg="black") Vhija2.geometry("500x300") Rectangulo= Canvas(Vhija2,width=300, height=210, bg='white') Rectangulo.pack(expand=YES, fill=BOTH) Rectangulo.create_rectangle(10, 10, 410, 200, width=5, fill='gold') BotonRectangulo1= Button(Rectangulo, text="ocultar ventana", command=lambda: ejecutar(ocultar(Vhija2))) BotonRectangulo1.grid(row=1, column=3) Vhija2.deiconify() def mostrarlineas(): Vhija3= Toplevel(VentanaPrincipal) Vhija3.title("LINEAS") Vhija3.protocol("WM_DELETE_WINDOW", "onexit") Vhija3.config(bg="black") Vhija3.geometry("300x300") linea= Canvas(Vhija3,width=300, height=210, bg='white') linea.pack(expand=YES, fill=BOTH) linea.create_line(0, 200, 200, 0, width=10, fill='blue') linea.create_line(0, 0, 200, 200, width=10, fill='blue') Botonlinea= Button(linea, text="ocultar ventana", command=lambda: ejecutar(ocultar(Vhija3))) Botonlinea.grid(row=1, column=3) Vhija3.deiconify() def mostrarqueso(): Vhija4= Toplevel(VentanaPrincipal) Vhija4.title("CIRCULO") Vhija4.protocol("WM_DELETE_WINDOW", "onexit") Vhija4.config(bg="green") Vhija4.geometry("500x500") queso=Canvas(Vhija4, 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') Botonqueso1 = Button(queso, text="ocultar ventana", command=lambda: ejecutar(ocultar(Vhija4))) Botonqueso1.grid(row=1, column=3) Vhija4.deiconify() def mostrararco(): Vhija5= Toplevel(VentanaPrincipal) Vhija5.title("CIRCULO") Vhija5.protocol("WM_DELETE_WINDOW", "onexit") Vhija5.config(bg="green") Vhija5.geometry("500x500") arco = Canvas(Vhija5, width=300, height=200, bg='white') arco.pack(expand=YES, fill=BOTH) xy = 40, 40, 190, 190 arco.create_arc(xy, start=0, extent=270, fill='gray60') Botonqueso1 = Button(arco, text="ocultar ventana", command=lambda: ejecutar(ocultar(Vhija5))) Botonqueso1.grid(row=1, column=3) Vhija5.deiconify() def mostrarpay(): Vhija6 = Toplevel(VentanaPrincipal) Vhija6.title("PAY") Vhija6.protocol("WM_DELETE_WINDOW", "onexit") Vhija6.config(bg="green") Vhija6.geometry("500x500") queso = Canvas(Vhija6, width=300, height=200, bg='white') queso.pack(expand=YES, fill=BOTH) queso.create_arc(60, 60, 200, 200, start=270, extent=90, fill='gray90') queso.pack(expand=YES, fill=BOTH) xy = 50, 50, 200, 200 queso.create_arc(xy, start=0, extent=270, fill='yellow') Botonpay = Button(queso, text="ocultar ventana", command=lambda: ejecutar(ocultar(Vhija6))) Botonpay.grid(row=1, column=3) Vhija6.deiconify() boton1= Button(VentanaPrincipal, text="CIRCULO", command=lambda: ejecutar(mostrarcirculo())) boton1.grid(row=1, column=1) boton2= Button(VentanaPrincipal, text="RECTANGULO", command=lambda: ejecutar(mostrarrectangulo())) boton2.grid(row=1, column=2) boton3= Button(VentanaPrincipal, text="LINEAS", command=lambda: ejecutar(mostrarlineas())) boton3.grid(row=1, column=3) boton4= Button(VentanaPrincipal, text="Cerrar Ventana Principal", command=lambda: ejecutar(ocultar(VentanaPrincipal))) boton4.grid(row=1, column=7) boton5= Button(VentanaPrincipal, text="QUESO", command=lambda: ejecutar(mostrarqueso())) boton5.grid(row=1, column=4) boton6= Button(VentanaPrincipal, text="ARCO", command=lambda: ejecutar(mostrararco())) boton6.grid(row=1, column=5) boton7= Button(VentanaPrincipal, text="PAY", command=lambda: ejecutar(mostrarpay())) boton7.grid(row=1, column=6) VentanaPrincipal.mainloop()
lunes, 18 de septiembre de 2017
Múltiples figuras en ventanas hijas
Suscribirse a:
Enviar comentarios (Atom)
Conclusion de funciones de una DBA
Una base de datos es una coleccion de información accedida y administrada por un DBMS. El DBA es la persona con mas conocimientos sobre bas...
-
Pygame : Sin duda la librería más famosa de Python. Pygame lleva en desarrollo desde el 2001 por lo que tiene un gran comunidad, publicánd...
-
Un administrador de base de datos (DBA) dirige o lleva a cabo todas las actividades relacionadas con el mantenimiento de un entorno de base...
-
Definición 1: Un fractal es un ente geométrico el cual en su desarrollo espacial se va reproduciendo a si mismo cada vez a una escala men...
No hay comentarios:
Publicar un comentario