Multiple Functions Bound to a Single Widget
I'm binding multiple functions to a single widget using 开发者_运维知识库the same sequence (in this case the '<Button>'
sequence) in Tkinter. To do this I'm using the add
argument. Is it possible to get all the functions bound to a particular sequence?
snippet :
wid.bind('<Button>', func0)
wid.bind('<Button>', func1, add=True)
If I understand the question correctly, you can create one callback function:
def cb(event):
func0()
func1()
# ...
wid.bind('<Button>', cb)
Also, you can replace add=True
with '+'
:
wid.bind('<Button>, func1, '+')
精彩评论