[New-bugs-announce] [issue31485] Tkinter widget.unbind(sequence, funcid) unbind all bindings

Juliette Monsel report at bugs.python.org
Fri Sep 15 09:57:14 EDT 2017


New submission from Juliette Monsel:

I am using python 3.6.2 with tk 8.6.7 in Linux and when I call widget.unbind(<Sequence>, funcid), it unbinds all bindings for <Sequence>, while I would expect it to unbind only funcid. Here is an example reproducing the problem:


import tkinter as tk

root = tk.Tk()

def cmd1(event):
    print('1')

def cmd2(event):
    print('2')

def unbind1():
    l.unbind('<Motion>', b1)

def unbind2():
    l.unbind('<Motion>', b2)

l = tk.Label(root, text='Hover')

b1 = l.bind('<Motion>', cmd1)
b2 = l.bind('<Motion>', cmd2, True)

l.pack()
tk.Button(root, text='Unbind 1', command=unbind1).pack()
tk.Button(root, text='Unbind 2', command=unbind2).pack()

root.mainloop()


In this example, clicking on one of the buttons unbinds both bindings instead of only one.

----------
components: Tkinter
messages: 302256
nosy: j-4321-i
priority: normal
severity: normal
status: open
title: Tkinter widget.unbind(sequence, funcid) unbind all bindings
type: behavior
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31485>
_______________________________________


More information about the New-bugs-announce mailing list