New submission from Clinton Hunter <mrsh...@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 <rep...@bugs.python.org> <https://bugs.python.org/issue39642> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com