[Tkinter-discuss] tag_bind

geon geon at post.cz
Sun Mar 26 22:01:17 CEST 2006


Hi,

On a canvas I would like to bind my "player" with arrows keys, but must 
be there something wrong, cause it is not able to bind it. This is my code:

from Tkinter import *

def move(what):
    print what.keycode


master=Tk()
myCanvas=Canvas(master, bg="white")
pos=(20,20,30,30)
player=myCanvas.create_oval(pos, fill="blue")

myCanvas.focus(player)
myCanvas.tag_bind(player, "<Up>", move)
myCanvas.pack()

mainloop()

Thank you for your help.

-- 
geon
volume doprava.



More information about the Tkinter-discuss mailing list