from tkinter import *
import time
tk = Tk()
canvas = Canvas(tk, width=500,heigh=500)
canvas.pack()
rocket_obj = PhotoImage(file="rocket.png")
id_img = canvas.create_image(50,50,anchor=NW,image=rocket_obj)
def move_rocket(event):
if event.keysym == "Up":
canvas.move(id_img,0,-5)
elif event.keysym == "Down":
canvas.move(id_img,0,5)
elif event.keysym == "Left":
canvas.move(id_img,-5,0)
elif event.keysym == "Right":
canvas.move(id_img,5,0)
canvas.bind_all("<KeyPress-Up>",move_rocket)
canvas.bind_all("<KeyPress-Down>",move_rocket)
canvas.bind_all("<KeyPress-Left>",move_rocket)
canvas.bind_all("<KeyPress-Right>",move_rocket)
tk.mainloop()
P. S. Не забудьте отметить решением, если поможет