# -*- 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() 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=5) VentanaPrincipal.mainloop()
lunes, 11 de septiembre de 2017
Python: 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