Tk Source Code

View Ticket
Login
Ticket UUID: 67c8e8bd7181b6b96e3e8dc8bc5493aa12e192e9
Title: DISABLEd Tkinter.Listbox still fires <<ListboxSelect>> for mouse click
Type: Bug Version: 8.5
Submitter: anonymous Created on: 2013-07-20 02:43:35
Subsystem: 01. Bindings Assigned To: fvogel
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2016-08-08 21:19:37
Resolution: Duplicate Closed By: fvogel
    Closed on: 2016-08-08 21:19:37
Description:
Run the script below. Clicking on the window will fire off <<ListboxSelect>> events even though the widget is disabled. Keyboard actions do not fire this event. I was bounced by the Python guys to you.

#-- Test file --

import Tkinter as tki

def selection_changed(event):
  print 'Selection changed'

root = tki.Tk()
listbox = tki.Listbox(root, selectmode=tki.BROWSE)
listbox.pack(side='left', fill='both', expand=True)
listbox.bind('<<ListboxSelect>>', selection_changed)
listbox.config(state=tki.DISABLED)
root.mainloop()
User Comments: fvogel added on 2016-08-08 21:19:37:

This could be reproduced in Tcl/Tk (no Python) with:

package require Tk pack [listbox .l] bind .l <<ListboxSelect>> {puts "<<ListBoxSelect>> fired!"} .l configure -state disabled # click in the listbox --> the event fires

But this was before bug [1288433] was fixed.

Closing the present report as duplicate of the above bug.