miércoles, 27 de septiembre de 2017

figuras



from Tkinter import *
ventanaprin = Tk()
ventanaprin.config(
bg="lightblue")
ventanaprin.geometry(
"700x500")
ventanaprin.title(
"Ventana")
ventacir = Toplevel(ventanaprin)
ventacir.protocol(
"WM_DELETE_WINDOW", "onexit")

ventarec = Toplevel(ventanaprin)
ventarec.protocol(
"WM_DELETE_WINDOW", "onexit")

ventalin = Toplevel(ventanaprin)
ventalin.protocol(
"WM_DELETE_WINDOW", "onexit")

ventarc = Toplevel(ventanaprin)
ventarc.protocol(
"WM_DELETE_WINDOW", "onexit")

ventaqueso = Toplevel(ventanaprin)
ventaqueso.protocol(
"WM_DELETE_WINDOW", "onexit")

venarcque = Toplevel(ventanaprin)
venarcque.protocol(
"WM_DELETE_WINDOW", "onexit")

venpoligono = Toplevel(ventanaprin)
venpoligono.protocol(
"WM_DELETE_WINDOW", "onexit")

ventexto = Toplevel(ventanaprin)
ventexto.protocol(
"WM_DELETE_WINDOW", "onexit")

nuevopoli= Toplevel(ventanaprin)
nuevopoli.protocol(
"WM_DELETE_WINDOW", "onexit")

figurita= Toplevel(ventanaprin)
figurita.protocol(
"WM_DELETE_WINDOW", "onexit")
def ejecutar(f):
 ventacir.after(
200, f)

def ejecutar2(f):
 ventarec.after(
200, f)

def ejecutar3(f):
 ventalin.after(
200, f)

def ejecutar4(f):
 ventarc.after(
200, f)

def ejecutar5(f):
 ventaqueso.after(
200, f)

def ejecutar6(f):
 venarcque.after(
200,f)

def ejecutar7(f):
 venpoligono.after(
200,f)

def ejecutar8(f):
  ventexto.after(
200, f)

def ejecutar9(f):
  nuevopoli.after(
200, f)

def ejecutar10(f):
  figurita.after(
200, f)

def mostrar(ventana):
  ventana.deiconify()

def circulo(ven):
 circulo = Canvas(ventacir,
width=210, height=210, bg="lightblue")
 circulo.pack(
expand=YES, fill=BOTH)
 circulo.create_oval(
10, 10, 200, 200, width=3, fill='pink')
 ventacir.deiconify()

def rectangulo(ven):
 rectangulo = Canvas(ventarec,
width=210, height=210, bg="pink")
 rectangulo.pack(
expand=YES, fill=BOTH)
 rectangulo.create_rectangle(
10, 10, 200, 200, width=3, fill='orange')
 ventarec.deiconify()

def linea(ven):
 linea = Canvas(ventalin,
width=210, height=210, bg="white")
 linea.pack(
expand=YES, fill=BOTH)
 linea.create_line(
5, 5, 200, 200, width=10, fill='purple')
 ventalin.deiconify()


def arco(ven):
 canvas = Canvas(ventarc,
width=300, height=200, bg='white')
 canvas.pack(
expand=YES, fill=BOTH)
 canvas.create_arc(
10, 10, 190, 190, start=0, extent=270, fill='orange')
 ventarc.deiconify()

def quesito(ven):
 canvas = Canvas(ventaqueso,
width=300, height=200, bg='white')
 canvas.pack(
expand=YES, fill=BOTH)
 canvas.create_arc(
10, 10, 190, 190, start=270, extent=90, fill='gold')
 ventaqueso.deiconify()

def arcoque (ven):
    canvas = Canvas(venarcque,
width=300, height=200, bg='white')
    canvas.pack(
expand=YES, fill=BOTH)
    canvas.create_arc(
10, 10, 190, 190, start=0, extent=270, fill='gold')
    canvas.create_arc(
10, 10, 190, 190, start=270, extent=90, fill='orange')
    venarcque.deiconify()

def texto(ven):
   canvas = Canvas(ventexto,
width=300, height=200, bg='white')
   canvas.create_text(
150, 70, fill="violet", font="Times 30 italic bold", text="Que\nMaravillosa\n es la naturaleza.")
   canvas.pack(
expand=YES, fill=BOTH)
   ventexto.deiconify()

def poligono(ven):
  canvas = Canvas(venpoligono,
width=300, height=200, bg='white')
  canvas.create_polygon(
40, 40, 40, 140, 140, 140, 140, 100, fill="pink", outline="magenta", width=6)
  canvas.pack(
expand=YES, fill=BOTH)
  venpoligono.deiconify()

def nuevopoligono(ven):
   canvas = Canvas(nuevopoli,
width=500, height=300, bg='brown')
   canvas.create_polygon(
50 ,50,
200 ,50,
200 ,100,
300 ,100,
300 ,50,
350 ,50,
350 ,100,
400 ,100,
400 ,150,
200 ,150,
200 ,200,
50 ,200,
50 ,50,
100, 100,
150,100,
150 ,150,
100 ,150,
100 ,100,
fill="gold", outline="black", width=6)
   canvas.pack(
expand=YES, fill=BOTH)
   nuevopoli.deiconify()

def nuevafigurita(ven):
   canvas = Canvas(figurita,
width=300, height=200, bg='lightblue')
   canvas.create_polygon(
130,20,
                             150,90,
                             210,90,
                             160,130,
                             180,200,
                             130,160,
                             80,200,
                             100,130,
                             50,90,
                             110,90,


       fill="pink", outline="magenta", width=6)
   canvas.pack(
expand=YES, fill=BOTH)
   figurita.deiconify()

def ocultar(ventana):

 ventacir.withdraw()
 ventarec.withdraw()
 ventalin.withdraw()
 ventarc.withdraw()
 ventaqueso.withdraw()
 venarcque.withdraw()
 ventexto.withdraw()
 venpoligono.withdraw()
 nuevopoli.withdraw()
 figurita.withdraw()
cerra1= Button(ventacir,
text="CERRAR", command=lambda: ejecutar(ocultar(ventacir)))
cerra1.pack()
cerrar2= Button(ventarec,
text="CERRAR", command=lambda: ejecutar2(ocultar(ventarec)))
cerrar2.pack()
cerrar3= Button(ventalin,
text="CERRAR", command=lambda: ejecutar3(ocultar(ventalin)))
cerrar3.pack()
cerrar4= Button(ventarc,
text="CERRAR", command=lambda: ejecutar4(ocultar(ventarc)))
cerrar4.pack()
cerrar5= Button(ventaqueso,
text="CERRAR", command=lambda: ejecutar5(ocultar(ventaqueso)))
cerrar5.pack()
cerrar6= Button(venarcque,
text="CERRAR", command=lambda: ejecutar6(ocultar(venarcque)))
cerrar6.pack()
cerrar7= Button(ventexto,
text="CERRAR", command=lambda: ejecutar7(ocultar(ventexto)))
cerrar7.pack()
cerrar8= Button(venpoligono,
text="CERRAR", command=lambda: ejecutar8(ocultar(venpoligono)))
cerrar8.pack()
cerrar9= Button(nuevopoli,
text="CERRAR", command=lambda: ejecutar9(ocultar(nuevopoli)))
cerrar9.pack()
cerrar10= Button(figurita,
text="CERRAR", command=lambda: ejecutar10(ocultar(figurita)))
cerrar10.pack()

botoncir = Button(ventanaprin,
text="CIRCULO", command=lambda: ejecutar (circulo(ventanaprin)))
botoncir.grid(
row=1, column=1)
botonrec = Button(ventanaprin,
text="RECTANGULO", command=lambda: ejecutar (rectangulo(ventanaprin)))
botonrec.grid(
row=1, column=2)
botonlin = Button(ventanaprin,
text="LINEA", command=lambda: ejecutar (linea(ventanaprin)))
botonlin.grid(
row=1, column=3)
botonque = Button(ventanaprin,
text="QUESITO", command=lambda: ejecutar (quesito(ventanaprin)))
botonque.grid(
row=1, column=4)
botonarc = Button(ventanaprin,
text="ARCO", command=lambda: ejecutar (arco(ventanaprin)))
botonarc.grid(
row=1, column=5)
botonarcque = Button(ventanaprin,
text="ARCO Y QUESITO ", command=lambda: ejecutar (arcoque(ventanaprin)))
botonarcque.grid(
row=1, column=6)

botontexto = Button(ventanaprin,
text="TEXTO ", command=lambda: ejecutar (texto(ventanaprin)))
botontexto.grid(
row=1, column=7)
botopoligono = Button(ventanaprin,
text="POLIGONO ", command=lambda: ejecutar (poligono(ventanaprin)))
botopoligono.grid(
row=1, column=8)
botopoligo = Button(ventanaprin,
text="LLAVE", command=lambda: ejecutar (nuevopoligono(ventanaprin)))
botopoligo.grid(
row=1, column=9)
nuevafig = Button(ventanaprin,
text="ESTRELLA", command=lambda: ejecutar (nuevafigurita(ventanaprin)))
nuevafig.grid(
row=1, column=10)

ventacir.withdraw()
ventarec.withdraw()
ventalin.withdraw()
ventarc.withdraw()
ventaqueso.withdraw()
venarcque.withdraw()
ventexto.withdraw()
venpoligono.withdraw()
nuevopoli.withdraw()
figurita.withdraw()
ventanaprin.mainloop()

from Tkinter import *
ventanaprin = Tk()
ventanaprin.config(
bg="lightblue")
ventanaprin.geometry(
"700x500")
ventanaprin.title(
"Ventana")
ventacir = Toplevel(ventanaprin)
ventacir.protocol(
"WM_DELETE_WINDOW", "onexit")

ventarec = Toplevel(ventanaprin)
ventarec.protocol(
"WM_DELETE_WINDOW", "onexit")

ventalin = Toplevel(ventanaprin)
ventalin.protocol(
"WM_DELETE_WINDOW", "onexit")

ventarc = Toplevel(ventanaprin)
ventarc.protocol(
"WM_DELETE_WINDOW", "onexit")

ventaqueso = Toplevel(ventanaprin)
ventaqueso.protocol(
"WM_DELETE_WINDOW", "onexit")

venarcque = Toplevel(ventanaprin)
venarcque.protocol(
"WM_DELETE_WINDOW", "onexit")

venpoligono = Toplevel(ventanaprin)
venpoligono.protocol(
"WM_DELETE_WINDOW", "onexit")

ventexto = Toplevel(ventanaprin)
ventexto.protocol(
"WM_DELETE_WINDOW", "onexit")

nuevopoli= Toplevel(ventanaprin)
nuevopoli.protocol(
"WM_DELETE_WINDOW", "onexit")

figurita= Toplevel(ventanaprin)
figurita.protocol(
"WM_DELETE_WINDOW", "onexit")
def ejecutar(f):
 ventacir.after(
200, f)

def ejecutar2(f):
 ventarec.after(
200, f)

def ejecutar3(f):
 ventalin.after(
200, f)

def ejecutar4(f):
 ventarc.after(
200, f)

def ejecutar5(f):
 ventaqueso.after(
200, f)

def ejecutar6(f):
 venarcque.after(
200,f)

def ejecutar7(f):
 venpoligono.after(
200,f)

def ejecutar8(f):
  ventexto.after(
200, f)

def ejecutar9(f):
  nuevopoli.after(
200, f)

def ejecutar10(f):
  figurita.after(
200, f)

def mostrar(ventana):
  ventana.deiconify()

def circulo(ven):
 circulo = Canvas(ventacir,
width=210, height=210, bg="lightblue")
 circulo.pack(
expand=YES, fill=BOTH)
 circulo.create_oval(
10, 10, 200, 200, width=3, fill='pink')
 ventacir.deiconify()

def rectangulo(ven):
 rectangulo = Canvas(ventarec,
width=210, height=210, bg="pink")
 rectangulo.pack(
expand=YES, fill=BOTH)
 rectangulo.create_rectangle(
10, 10, 200, 200, width=3, fill='orange')
 ventarec.deiconify()

def linea(ven):
 linea = Canvas(ventalin,
width=210, height=210, bg="white")
 linea.pack(
expand=YES, fill=BOTH)
 linea.create_line(
5, 5, 200, 200, width=10, fill='purple')
 ventalin.deiconify()


def arco(ven):
 canvas = Canvas(ventarc,
width=300, height=200, bg='white')
 canvas.pack(
expand=YES, fill=BOTH)
 canvas.create_arc(
10, 10, 190, 190, start=0, extent=270, fill='orange')
 ventarc.deiconify()

def quesito(ven):
 canvas = Canvas(ventaqueso,
width=300, height=200, bg='white')
 canvas.pack(
expand=YES, fill=BOTH)
 canvas.create_arc(
10, 10, 190, 190, start=270, extent=90, fill='gold')
 ventaqueso.deiconify()

def arcoque (ven):
    canvas = Canvas(venarcque,
width=300, height=200, bg='white')
    canvas.pack(
expand=YES, fill=BOTH)
    canvas.create_arc(
10, 10, 190, 190, start=0, extent=270, fill='gold')
    canvas.create_arc(
10, 10, 190, 190, start=270, extent=90, fill='orange')
    venarcque.deiconify()

def texto(ven):
   canvas = Canvas(ventexto,
width=300, height=200, bg='white')
   canvas.create_text(
150, 70, fill="violet", font="Times 30 italic bold", text="Que\nMaravillosa\n es la naturaleza.")
   canvas.pack(
expand=YES, fill=BOTH)
   ventexto.deiconify()

def poligono(ven):
  canvas = Canvas(venpoligono,
width=300, height=200, bg='white')
  canvas.create_polygon(
40, 40, 40, 140, 140, 140, 140, 100, fill="pink", outline="magenta", width=6)
  canvas.pack(
expand=YES, fill=BOTH)
  venpoligono.deiconify()

def nuevopoligono(ven):
   canvas = Canvas(nuevopoli,
width=500, height=300, bg='brown')
   canvas.create_polygon(
50 ,50,
200 ,50,
200 ,100,
300 ,100,
300 ,50,
350 ,50,
350 ,100,
400 ,100,
400 ,150,
200 ,150,
200 ,200,
50 ,200,
50 ,50,
100, 100,
150,100,
150 ,150,
100 ,150,
100 ,100,
fill="gold", outline="black", width=6)
   canvas.pack(
expand=YES, fill=BOTH)
   nuevopoli.deiconify()

def nuevafigurita(ven):
   canvas = Canvas(figurita,
width=300, height=200, bg='lightblue')
   canvas.create_polygon(
130,20,
                             150,90,
                             210,90,
                             160,130,
                             180,200,
                             130,160,
                             80,200,
                             100,130,
                             50,90,
                             110,90,


       fill="pink", outline="magenta", width=6)
   canvas.pack(
expand=YES, fill=BOTH)
   figurita.deiconify()

def ocultar(ventana):

 ventacir.withdraw()
 ventarec.withdraw()
 ventalin.withdraw()
 ventarc.withdraw()
 ventaqueso.withdraw()
 venarcque.withdraw()
 ventexto.withdraw()
 venpoligono.withdraw()
 nuevopoli.withdraw()
 figurita.withdraw()
cerra1= Button(ventacir,
text="CERRAR", command=lambda: ejecutar(ocultar(ventacir)))
cerra1.pack()
cerrar2= Button(ventarec,
text="CERRAR", command=lambda: ejecutar2(ocultar(ventarec)))
cerrar2.pack()
cerrar3= Button(ventalin,
text="CERRAR", command=lambda: ejecutar3(ocultar(ventalin)))
cerrar3.pack()
cerrar4= Button(ventarc,
text="CERRAR", command=lambda: ejecutar4(ocultar(ventarc)))
cerrar4.pack()
cerrar5= Button(ventaqueso,
text="CERRAR", command=lambda: ejecutar5(ocultar(ventaqueso)))
cerrar5.pack()
cerrar6= Button(venarcque,
text="CERRAR", command=lambda: ejecutar6(ocultar(venarcque)))
cerrar6.pack()
cerrar7= Button(ventexto,
text="CERRAR", command=lambda: ejecutar7(ocultar(ventexto)))
cerrar7.pack()
cerrar8= Button(venpoligono,
text="CERRAR", command=lambda: ejecutar8(ocultar(venpoligono)))
cerrar8.pack()
cerrar9= Button(nuevopoli,
text="CERRAR", command=lambda: ejecutar9(ocultar(nuevopoli)))
cerrar9.pack()
cerrar10= Button(figurita,
text="CERRAR", command=lambda: ejecutar10(ocultar(figurita)))
cerrar10.pack()

botoncir = Button(ventanaprin,
text="CIRCULO", command=lambda: ejecutar (circulo(ventanaprin)))
botoncir.grid(
row=1, column=1)
botonrec = Button(ventanaprin,
text="RECTANGULO", command=lambda: ejecutar (rectangulo(ventanaprin)))
botonrec.grid(
row=1, column=2)
botonlin = Button(ventanaprin,
text="LINEA", command=lambda: ejecutar (linea(ventanaprin)))
botonlin.grid(
row=1, column=3)
botonque = Button(ventanaprin,
text="QUESITO", command=lambda: ejecutar (quesito(ventanaprin)))
botonque.grid(
row=1, column=4)
botonarc = Button(ventanaprin,
text="ARCO", command=lambda: ejecutar (arco(ventanaprin)))
botonarc.grid(
row=1, column=5)
botonarcque = Button(ventanaprin,
text="ARCO Y QUESITO ", command=lambda: ejecutar (arcoque(ventanaprin)))
botonarcque.grid(
row=1, column=6)

botontexto = Button(ventanaprin,
text="TEXTO ", command=lambda: ejecutar (texto(ventanaprin)))
botontexto.grid(
row=1, column=7)
botopoligono = Button(ventanaprin,
text="POLIGONO ", command=lambda: ejecutar (poligono(ventanaprin)))
botopoligono.grid(
row=1, column=8)
botopoligo = Button(ventanaprin,
text="LLAVE", command=lambda: ejecutar (nuevopoligono(ventanaprin)))
botopoligo.grid(
row=1, column=9)
nuevafig = Button(ventanaprin,
text="ESTRELLA", command=lambda: ejecutar (nuevafigurita(ventanaprin)))
nuevafig.grid(
row=1, column=10)

ventacir.withdraw()
ventarec.withdraw()
ventalin.withdraw()
ventarc.withdraw()
ventaqueso.withdraw()
venarcque.withdraw()
ventexto.withdraw()
venpoligono.withdraw()
nuevopoli.withdraw()
figurita.withdraw()
ventanaprin.mainloop()












Conclusión   del equipo #1: Puertos paralelos  Un puerto paralelo es una interfaz entre un ordenador y un periférico. El puerto paralelo ...