开发者

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, '+')
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜