Tkinter binding list

Jeff Epler jepler at unpythonic.net
Sat Dec 6 19:45:08 EST 2003


The bind method with one argument returns the string of tcl code that is
the current binding.  For instance:
>>> t = Tkinter.Tk()
>>> t.bind("<<V>>", lambda evt: None)
'136008116<lambda>'
>>> t.bind("<<V>>", lambda evt: None, "+")
'136776692<lambda>'
>>> t.bind("<<V>>")
'if {"[136008116<lambda> %# %b %f %h %k %s %t %w %x %y %A %E %K %N %W %T
%X %Y %D]" == "break"} break\n\nif {"[136776692<lambda> %# %b %f %h %k
%s %t %w %x %y %A %E %K %N %W %T %X %Y %D]" == "break"} break\n'
>>> 

The bind method with zero arguments returns all the existing bindings:
>>> t.bind()
('<<V>>',)

Jeff





More information about the Python-list mailing list