Círculo, un rectángulo y una cruz dibujados. Programas en Python.

from Tkinter import * 
root = Tk()  
root.title('Ejemplo') 

circulo = Canvas(width=210, height=210, bg='white') 
circulo.pack(expand=YES, fill=BOTH) 
circulo.create_oval(10, 10, 200, 200, width=5, fill='blue')

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

linea = Canvas(width=210, height=210, bg='white')
linea.pack(expand=YES, fill=BOTH)
linea.create_line(0, 200, 200, 0, width=10, fill='black')
linea.create_line(0, 0, 200, 200, width=10, fill='black')

root.mainloop()




Código para hacer el círculo sería:

from Tkinter import *

root = Tk() 
root.title('Ejemplo')
circulo = Canvas(width=210, height=210, bg='white') 
circulo.pack(expand=YES, fill=BOTH) 
circulo.create_oval(10, 10, 200, 200, width=5, fill='blue') 



root.mainloop()

El código para hacer el rectángulo sería:

from Tkinter import *

root = Tk() 
root.title('Ejemplo')

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

root.mainloop()




Código para hacer una cruz sería:


from Tkinter import * 
root = Tk()  
root.title('Ejemplo') 

linea = Canvas(width=210, height=210, bg='white')
linea.pack(expand=YES, fill=BOTH)
linea.create_line(0, 200, 200, 0, width=10, fill='black')
linea.create_line(0, 0, 200, 200, width=10, fill='black')

root.mainloop()



Comentarios

Entradas más populares de este blog

Juego del Gato en Python

EMU8086 - Registro de banderas