Tkinter unbind被打破了

时间:2016-11-04 15:39:33

标签: python-2.7 tkinter

以下代码正常工作,直到root.unbind(seq,fid2)删除两个绑定。我正在跑2.7。

我已经看到了解决此问题的问题here。它似乎工作 - 它修复了下面的代码的问题 - 但我感到不安修改Tkinter的来源。 任何人都知道这个bug已经在tkinter中得到修复(Python 3)?

import Tkinter as tk

root = tk.Tk()
def cb1(e):
    pass
def cb2(e):
    pass
seq = "<Motion>"
print "before any bindings", root.bind(seq)
fid1 = root.bind(seq, cb1, add='+')
print "after bind cb1", root.bind(seq)
fid2 = root.bind(seq, cb2, add='+')
print "after bind cb2", root.bind(seq)
root.unbind(seq, fid1)
print "after unbind cb1", root.bind(seq)

0 个答案:

没有答案