move + elif event keysym='left 'move -= canvas coords(rect, +move, , +move, root tk(root bind'callbackcanvas canvas(width= ,height= canvas grid(row= ,column= rect canvas create_rectangle( , , , ,fill'blue 'move mainloop(example here is an example program demonstrating mouse events the program starts by drawing rectangle to the screen the user can do the followingdrag the rectangle with the mouse (resize the rectangle with the mouse wheel (whenever the user left-clicksthe rectangle will change colors (anytime the mouse is movedthe current coordinates of the mouse are displayed in label (here is the code for the programfrom tkinter import def mouse_motion_event(event)label configure(text'({}{}format(event xevent )def wheel_event(event)global if event delta> diff elif event delta< diff - +=diff -=diff +=diff -=diff canvas coords(rect, , , , def _event(event)global color if not _dragcolor 'red if color='blue else 'blue canvas itemconfigure(rectfill=color