import tkinter as tk root=tk.Tk() root.geometry("500x500+450+100") canvas1=tk.Canvas(root, width=500, heigh=500) canvas1.pack() x=250 y=250 def keypressed(k): global x global y if k.keysym=='Up': y+=-1 if k.keysym=='Down': y+=1 if k.keysym=='Left': x+=-1 if k.keysym=='Right': x+=1 text=tk.Label(root, text= 'X', fg='yellow', bg='blue') canvas1.create_window(x,y, window=text) root.bind('', keypressed) root.mainloop()