If the "mini state" method you are talking about refers to this answer (Python bind - allow multiple keys to be pressed simultaneously), it is actually not that difficult to understand.
See below a modified & commented version of your code which follows that philosophy:
from tkinter import tk
window = tk.Tk()
window.title('Test')
canvas = tk.Canvas(window, height=500, width=500)
canvas.pack()
box = canvas.create_rectangle(50, 50, 60, 60, fill='blue')
def move(x, y):
canvas.move(box, x, y)
# This dictionary stores the current pressed status of the (← ↑ → ↓) keys
# (pressed: True, released: False) and will be modified by Pressing or Releasing each key
pressedStatus = {"Up": False, "Down": False, "Left": False, "Right": False}
def pressed(event):
# When the key "event.keysym" is pressed, set its pressed status to True
pressedStatus[event.keysym] = True
def released(event):
# When the key "event.keysym" is released, set its pressed status to False
pressedStatus[event.keysym] = False
def set_bindings():
# Bind the (← ↑ → ↓) keys's Press and Release events
for char in ["Up", "Down", "Left", "Right"]:
window.bind("<KeyPress-%s>" % char, pressed)
window.bind("<KeyRelease-%s>" % char, released)
def animate():
# For each of the (← ↑ → ↓) keys currently being pressed (if pressedStatus[key] = True)
# move in the corresponding direction
if pressedStatus["Up"] == True: move(0, -10)
if pressedStatus["Down"] == True: move(0, 10)
if pressedStatus["Left"] == True: move(-10, 0)
if pressedStatus["Right"] == True: move(10, 0)
canvas.update()
# This method calls itself again and again after a delay (80 ms in this case)
window.after(80, animate)
# Bind the (← ↑ → ↓) keys's Press and Release events
set_bindings()
# Start the animation loop
animate()
# Launch the window
window.mainloop()