from tkinter import *
from math import *

def reaction (event) :
    global xc,yc,rond
    x,y=event.x,event.y
    if sqrt((x-xc)**2+(y-yc)**2) > 20:
        ecran.itemconfigure(rond,fill='blue')
        ecran.move(rond,x-xc,y-yc)
        xc,yc=x,y
    else :
        ecran.itemconfigure(rond,fill='red')
        
    
fenetre=Tk()
fenetre.title("Bonjour")

ecran=Canvas(fenetre,width=1000,height=600,bg="white")
ecran.pack(side=LEFT)
ecran.bind("<Button-1>",reaction)


xc,yc=500,300

rond = ecran.create_oval(xc-20,yc-20,xc+20,yc+20,fill='blue')



fenetre.mainloop()


