Voici le contenu de
from tkinter import *
def KeyBoard(event):
global PosX,PosY
Key = event.keysym
if Key == 'Right':
PosY -= 20
if Key == 'Up':
PosY += 20
if Key == 'Left':
PosX += 20
if Key == 'Down':
PosX -= 20
MyCanvas.coords(Piece,PosX -10, PosY -10, PosX +10, PosY +10)
MyWindow = Tk()
MyWindow.title('Piece')
PosX = 230
PosY = 150
MyCanvas = Canvas(MyWindow, width = 480, height =320, bg ='white')
Piece = MyCanvas.create_oval(PosX-10,PosY-10,PosX+10,PosY+10,width=2,outline='black',fill='red')
MyCanvas.focus_set()
MyCanvas.bind('<Key>',KeyBoard)
MyCanvas.pack(padx =50, pady =50)
Button(MyWindow, text ='Exit', command = MyWindow.destroy).pack(side=LEFT,padx=5,pady=5)
MyWindow.mainloop()