from Tkinter import *
canvas_width=500canvas_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("<B1-Motion>", paint)
mensaje=Label(master, text="presione o arrastre con el mouse")
mensaje.pack(side=BOTTOM)
boton=Button(master, text="borrsr", command=borrartodo)
boton.pack(side=BOTTOM)
master.mainloop()
Comentarios
Publicar un comentario