========CODIGO DE CIRCULO========
from Tkinter import *
v1 = Tk()
v1.title("Figura")
v1.config(bg="black")
v1.geometry("250x270")
def ejecutar(f): v1.after(200, f)
def cir(ven): circulo = Canvas(v1, width=210, height=210, bg="#07818e")
circulo.pack()
circulo.create_oval(10, 10, 200, 200, width=3, fill="#201659")
def ocultar(ventana): v1.withdraw()
br = Button(v1, text="Ver circulo", relief=FLAT, bg='black', command=lambda: ejecutar(cir(v1)), fg='#ffffff')
br.pack()
bc = Button(v1, text="Cerrar", relief=FLAT, bg='black', command=lambda: ejecutar(ocultar(v1)), fg='#ffffff')
bc.pack(side=BOTTOM)
v1.mainloop()
========CODIGO DE CUADRADO========
from Tkinter import *
v1 = Tk()
v1.title("Figura")
v1.config(bg="black")
v1.geometry("250x270")
def ejecutar(f): v1.after(200, f)
def recta(ven): rec = Canvas(width=210, height=210, bg='#07818e')
rec.pack()
rec.create_rectangle(10, 10, 200, 200, width=5, fill="blue")
def ocultar(ventana): v1.withdraw()
br = Button(v1, text="Ver cuadrado", relief=FLAT, bg='black', command=lambda: ejecutar(recta(v1)), fg='#ffffff')
br.pack()
bc = Button(v1, text="Cerrar", relief=FLAT, bg='black', command=lambda: ejecutar(ocultar(v1)), fg='#ffffff')
bc.pack(side=BOTTOM)
v1.mainloop()
========CODIGO DE LINEA========
from Tkinter import *
v1 = Tk()
v1.title("Figura")
v1.config(bg="black")
v1.geometry("250x270")
def ejecutar(f): v1.after(200, f)
def recta(ven): linea = Canvas(width=210, height=210, bg='#07818e')
linea.pack()
linea.create_line(0, 200, 200, 0, width=10, fill='purple')
def ocultar(ventana): v1.withdraw()
br = Button(v1, text="Ver linea", relief=FLAT, bg='black', command=lambda: ejecutar(recta(v1)), fg='#ffffff')
br.pack()
bc = Button(v1, text="Cerrar", relief=FLAT, bg='black', command=lambda: ejecutar(ocultar(v1)), fg='#ffffff')
bc.pack(side=BOTTOM)
v1.mainloop()
No hay comentarios:
Publicar un comentario