from Tkinter import *
v0 = Tk()
v0.config(bg="black")
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()
def texto():
v1 = Toplevel(v0)
v1.deiconify()
texto1=Canvas(v1, width=210, height=210, bg="blue")
texto1.pack(expand=YES, fill=BOTH)
texto1.create_text(150,70,fill="red",font="Times 30 italic bold",text=" Hola!\nsoy David")
b4 = Button(v1, text="Cerrar ", command=lambda: v1.destroy())
b4.pack()
def pol():
v1 = Toplevel(v0)
v1.deiconify()
poligono = Canvas(v1, width=210, height=210, bg="blue")
poligono.pack(expand=YES, fill=BOTH)
poligono.create_polygon(40, 40, 40, 140, 140, 140, 140, 100, fill="lightblue", outline="brown", width=6)
b4 = Button(v1, text="Cerrar ", 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)
b8 = Button(v0, text="Texto", command=lambda: texto())
b8.grid(row=1, column=7)
b9 = Button(v0, text="Poligono", command=lambda: pol())
b9.grid(row=1, column=8)
v0.mainloop()
Comentarios
Publicar un comentario