FIGURA 3D #-*-coding: utf-8-*- from Tkinter import * vp=Tk() vp.title( "Cubo" ) vp.config(bg= "gray" ) vp.geometry( "500x500" ) def ejecutar (f): vp.after(200,f) def r(ventana): r=Canvas(width=210,height=210,bg= "white" ) r.pack(expand=YES,fil=BOTH) r.create_rectangle(100,100,300,300, width=5,fill= "red" ) r.create_rectangle(200, 200, 420, 400, width=5, fill= "blue" ) r.create_polygon(300, 100, 420, 200, 200,200,100,100, fill= 'gray' ,outline= 'black' , width=5) r.create_polygon(200, 300, 100, 300, 200, 400,fill= 'green' ,outline= 'black' , width=5) r.create_line(300,100,300,300,fill= 'black' ,width=3,dash=(5, 5)) r.create_line(300, 300, 100, 300, fill= 'black' , width=3, dash=(5, 5)) r.create_line(300, 300,420,400, fill= 'black' , width=3, dash=(5, 5)) br=Button(vp,text= "Mostrar Cubo" , command= lambda :ejecutar(r
Entradas
Mostrando entradas de mayo, 2018
- Obtener enlace
- X
- Correo electrónico
- Otras aplicaciones
Ejercicios con Canvas #Programa que dibuja un ovalo #-*-coding: utf -8-*- from Tkinter import * import tkMessageBox vp = Tk() lienzo = Canvas(vp, bg = "blue" , height = 350 , width = 500 ) ovalo = lienzo.create_oval( 300 , 100 , 100 , 200 , width = 10 , fill = "red" ) lienzo.pack() vp.mainloop() #Programa que crea una cruz con dos lineas from Tkinter import * canvas = Canvas( width = 400 , height = 500 , bg = 'white' ) canvas.create_line( 200 , 200 , 350 , 350 ) canvas.create_line( 200 , 350 , 350 , 200 ) canvas.pack( expand =YES, fill =BOTH) mainloop() #Programa que crea figuras en una sola ventana from Tkinter import * canvas = Canvas( width = 400 , height = 300 , bg = 'white' ) canvas.create_oval( 100 , 30 , 180 , 80 , width = 2 , fill = 'green' ) canvas.create_arc( 200 , 10 , 280 , 100 ) canvas.create_rectangle( 10 , 100 , 200 , 200 , width = 5 , fill = 'red' ) canvas.create_text( 100 , 280 , text =