from Tkinter import *
v0 = Tk()
v0.config(bg="black") # Le da color al fondo
v0.geometry("500x500")
def circulo():
v1 = Toplevel(v0)
v1.deiconify()
circulo = Canvas(v1, width=210, height=210,bg='red')
circulo.pack(expand=YES, fill=BOTH)
circulo.create_oval(10, 10, 200, 200, width=3, fill='blue')
b4 = Button(v1, text="Cerrar circulo", command=lambda: v1.destroy())
b4.pack()
def rectangulo():
v1 = Toplevel(v0)
v1.deiconify()
rectangulo = Canvas(v1, width=210, height=210, bg='white')
rectangulo.pack(expand=YES, fill=BOTH)
rectangulo.create_rectangle(10, 10, 200, 200, width=5, fill='yellow')
b4 = Button(v1, text="Cerrar rectangulo", command=lambda: v1.destroy())
b4.pack()
def lineas():
v1 = Toplevel(v0)
v1.deiconify()
linea = Canvas(v1, width=210, height=210, bg='white')
linea.pack(expand=YES, fill=BOTH)
linea.create_line(0, 200, 200, 0, width=10, fill='black')
b4 = Button(v1, text="Cerrar linea", command=lambda: v1.destroy())
b4.pack()
def quesito():
v1 = Toplevel(v0)
v1.deiconify()
quesito = Canvas(v1, width=300, height=200, bg='white')
quesito.pack(expand=YES, fill=BOTH)
quesito.create_arc(10, 10, 190, 190, start=270, extent=90, fill='gray90')
b4 = Button(v1, text="Cerrar quesito", command=lambda: v1.destroy())
b4.pack()
def arco():
v1 = Toplevel(v0)
v1.deiconify()
arco = Canvas(v1, 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')
b4 = Button(v1, text="Cerrar arquito", command=lambda: v1.destroy())
b4.pack()
def quesitolleno():
v1 = Toplevel(v0)
v1.deiconify()
quesito = Canvas(v1, width=300, height=200, bg='white')
quesito.pack(expand=YES, fill=BOTH)
quesito.create_arc(20, 20, 200, 200, start=270, extent=90, fill='red')
quesito.pack(expand=YES, fill=BOTH)
xy = 10, 10, 190, 190
quesito.create_arc(xy, start=0, extent=270, fill='yellow')
b4 = Button(v1, text="Cerrar quesito relleno", command=lambda: v1.destroy())
b4.pack()
b1=Button(v0,text="Abrir circulo",command=lambda : circulo())
b1.grid(row=1,column=1)
b2=Button(v0,text="Abrir Rectangulo",command=lambda : rectangulo())
b2.grid(row=1,column=2)
b3=Button(v0,text="Abrir linea",command=lambda : lineas())
b3.grid(row=1,column=3)
b5=Button(v0,text="Abrir quesito",command=lambda : quesito())
b5.grid(row=1,column=4)
b6=Button(v0,text="Abrir arquito",command=lambda : arco())
b6.grid(row=1,column=5)
b7=Button(v0,text="Abrir quesito lleno",command=lambda : quesitolleno())
b7.grid(row=1,column=6)
v0.mainloop() # Es el evento que llama al inicio de nuestro programa. Siempre lo lleva la ventana principal.
No hay comentarios:
Publicar un comentario