textwidget.tag_bind("name", "<Any-KeyPress>", self.donothing) not working

jepler at unpythonic.net jepler at unpythonic.net
Tue Oct 25 16:37:06 EDT 2005


I'm not sure why Tk behaves this way, but you can observe the same behavior
with a "wish" script.  It would seem that "break" skips any other scripts
associated with item tags, but still proceeds to bindings at the widget level.
Using a binding with "break" on the canvas itself may help you get the behavior
you want.

########################################################################
canvas .c -width 70 -height 70
set it [.c create text 20 20 -tags x -text example -anchor nw]
.c bind x <KeyPress> { puts "item binding"; break; }
bind .c <KeyPress> { puts "widget binding"; break }
bind . <KeyPress> { puts "toplevel binding"; break }

pack .c
focus .c
.c focus $it
########################################################################

Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20051025/f5215e3a/attachment.sig>


More information about the Python-list mailing list