Pavel Kosina wrote:

> So in other words you would like to tell me that funcionality of
> tag_bind is broken? That it is not working in this version?

keyboard events are always sent to the item that has focus, and
you can only set focus to items that support the insertion cursor
protocol.

in stock tk/tkinter, "text" is the only item type that supports that
protocol.

</F>

#
# working keyboard tag_bind example

from Tkinter import *

def move(what):
    print what.keycode

myCanvas=Canvas(bg="white")
player=myCanvas.create_text((20, 20), text="hello", fill="blue")

myCanvas.focus(player)
myCanvas.focus_set() # <-- canvas must have focus
myCanvas.tag_bind(player, "<Up>", move)
myCanvas.pack()

mainloop()



_______________________________________________
Tkinter-discuss mailing list
[email protected]
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to