Python 在tkinter中解除所有画布项的绑定
我对特金特真的很陌生 我无法在tkinter中解除画布项目的绑定 这些物品是用塑料袋装订的Python 在tkinter中解除所有画布项的绑定,python,canvas,tkinter,Python,Canvas,Tkinter,我对特金特真的很陌生 我无法在tkinter中解除画布项目的绑定 这些物品是用塑料袋装订的 self.canvas = Canvas(root, background="white") self.canvas.create_line(x1, y1, x2, y2, fill="blue", tags=scale_index_tag) self.canvas.tag_bind(scale_index_tag, "<ButtonPress-1>", self.Add_weight) 如
self.canvas = Canvas(root, background="white")
self.canvas.create_line(x1, y1, x2, y2, fill="blue", tags=scale_index_tag)
self.canvas.tag_bind(scale_index_tag, "<ButtonPress-1>", self.Add_weight)
如果要使用
tag\u bind
绑定按钮,则需要使用tag\u unbind
解除绑定按钮。另外,unbind
(就像bind
)接受两个参数,在本例中是标记和按钮
self.canvas.tag_unbind(scale_index_tag, `"<ButtonPress-1>"`)
self.canvas.tag_解除绑定(缩放索引_标记,``)
好的。甚至canvas.destroy()也会破坏所有绑定吗?
self.canvas.delete(ALL)
self.canvas.tag_unbind(scale_index_tag, `"<ButtonPress-1>"`)