[issue39642] Behaviour of disabled widgets: widget.bind(func) -vs- w = widget(command=func)
Clinton Hunter
report at bugs.python.org
Sat Feb 15 22:11:33 EST 2020
New submission from Clinton Hunter <mrshr3d at gmail.com>:
Using the bind method, the event will still trigger when the widget is disabled. However, if using "command=" it doesn't. Wondering whether the behaviour between the two ways of setting up event handling should behave the same? Not a major issue, easy enough to work around using an if.
Example:
Clicking the printBtn will still work despite being disabled.
self.printBtn = tkinter.Button(self.frame, text='Print')
self.printBtn['state'] = tkinter.DISABLED
self.printBtn.bind(sequence='<Button-1>', func=self.printBtn_onclick)
self.printBtn.pack()
Clicking on the save button, the event will not trigger (ie the disabled state attribute is honored)
self.saveBtn = tkinter.Button(self.frame, text='Save', command=self.saveBtn_onclick)
self.saveBtn['state'] = tkinter.DISABLED
self.saveBtn.pack()
----------
components: Tkinter
messages: 362043
nosy: mrshr3d
priority: normal
severity: normal
status: open
title: Behaviour of disabled widgets: widget.bind(func) -vs- w = widget(command=func)
type: behavior
versions: Python 3.8
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39642>
_______________________________________
More information about the Python-bugs-list
mailing list