jueves, 7 de septiembre de 2017

Ventanas con figura

ventana de circulo:


from Tkinter import *
ventana = Tk() 

ventana.title("ventana de figura con boton")
ventana.config(
bg="magenta"
ventana.geometry("500x500"


def ejecutar(f):
    ventana.after(
200, f) 


def circulo(ventana):
    circulo = Canvas(
width=210, height=210,bg='pink')
    circulo.pack(
expand=YES, fill=BOTH)
    circulo.create_oval(
10, 10, 200, 200, width=3, fill='blue')


botoncir = Button(ventana,
text="ver circulo",
                 
command=lambda:
                  ejecutar (circulo(ventana))) 

botoncir.grid(row=3, column=15)

ventana.mainloop()





…………………………….

Ventana  figura  cuadrado:

from Tkinter import *  ventana = Tk()  # Tk() Es la ventana principalventana.title("ventana de figura con boton")
ventana.config(bg="pink")  # Le da color al fondoventana.geometry("500x500")  # Cambia el tamao de la ventana


def ejecutar(f):
    ventana.after(200, f)  # Una forma de ejecutar las funciones

def rectangulo(ventana):
    rectangulo = Canvas(width=210, height=210, bg='white')
    rectangulo.pack(expand=YES, fill=BOTH)
    rectangulo.create_rectangle(10, 10, 200, 200, width=5, fill='orange')




botonrect = Button(ventana, text="ver cuadro",
                  command=lambda:
                  ejecutar (rectangulo(ventana))) 
botonrect.grid(row=3, column=15
ventana.mainloop()

                                 
…………………………….


Linea

from Tkinter import
ventanita = Tk()
ventanita.title(
"ventana de figura con boton")
ventanita.config(
bg="purple"# Le da color al fondo
ventanita.geometry("500x500")


def ejecutar(f):
    ventanita.after(
200, f)

def lineas(ventana):
    linea = Canvas(
width=210, height=210, bg='white')
    linea.pack(
expand=YES, fill=BOTH)
    linea.create_line(
0, 200, 200, 0, width=10, fill='pink')



botonlinea = Button(ventanita,
text="ver linea",
                   
command=lambda:
                  ejecutar (lineas(ventanita)))

botonlinea.grid(row=3, column=15)
ventanita.mainloop()





                        

Video  # 12  programas  de funciones en python 





 

No hay comentarios.:

Publicar un comentario

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