1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
od=grille.create_oval(50,50,100,100,fill='black')
og=grille.create_oval(850,50,800,100,fill='black')
nez=grille.create_polygon(50,650,65,600,80,650,fill='black')
bouche=grille.create_oval(770,675,850,700,fill='black')
def action(event):
global x1,y1
x1=event.x
y1=event.y
print("Click de souris en :", event.x,event.y)
def click(event):
global x1,y1
def deplacer(event):
global x1,y1
x1=event.x
y1=event.y
a=grille.coords(og)
if x1>a[0] and x1<a[2] and y1>a[1] and y1<a[3]:
dx,dy=x1,y1
grille.move(og,dx,dy)
a=grille.coords(od)
if x1>a[0] and x1<a[2] and y1>a[1] and y1<a[3]:
dx,dy=x1,y1
grille.move(od,dx,dy)
a=grille.coords(nez)
if x1>a[0] and x1<a[2] and y1>a[1] and y1<a[3]:
dx,dy=x1,y1
grille.move(nez,dx,dy)
a=grille.coords(bouche)
if x1>a[0] and x1<a[2] and y1>a[1] and y1<a[3]:
dx,dy=x1,y1
grille.move(bouche,dx,dy)
return |
Partager