from Tkinter import *
canvas_width = 500
canvas_height = 150
def paint(event):
x1,y1 = (event.x - 1),(event.y - 1)
x2,y2 = (event.x + 1),(event.y + 1)
panel.create_oval(x1,y1,x2,y2, fill = "red")
def borrartodo():
panel.delete("all")
master = Tk()
master.title("Pinta con el mouse")
panel = Canvas(master, width = canvas_width, height = canvas_height)
panel.pack(expand = YES, fill = BOTH )
panel.bind("", paint)
mensaje = Label(master, text = "Presione o arrastre con el mouse")
mensaje.pack(side = BOTTOM)
boton = Button(master, text = "Borrar", command = borrartodo)
boton.pack(side = BOTTOM)
master.mainloop()
lunes, 22 de octubre de 2018
Programa de paint.
Suscribirse a:
Comentarios de la entrada (Atom)
No hay comentarios.:
Publicar un comentario