I am trying to write a code that would place a point/line/whatever at the mouse coordinates, aka Paint. I am using PIL and Tkinter. The problem is I can't understand how to realise canvas update.
window = Tk(className ='Window')
image = Image.new('RGB', (800,600),"#ffffff")
image_tk = PhotoImage(image)
canvas = Canvas(window,width = 800, height = 600)
canvas.create_image(400 ,300,image = image_tk)
canvas.pack()
draw = ImageDraw.Draw(image)
def mouseclick(event):
draw.point((event.x,event.y),fill=128)
print event.x,event.y
canvas.bind("<Button-1>", mouseclick)
mainloop()
What should be added? Maybe there are other better modules for doing it ?