When a tkinter form includes a listbox and other widgets, clicking on the other widgets (especially if the mouse is dragged) causes the listbox to lose its selection -- meaning that the element(s) that was/were selected/highlighted in the lisbox become unselected.
I've seen this problem discussed in one or two places on the Net, with this solution proposed: set the listbox exportselection
value to False
:
lb = Listbox(leftPane, width=24, height=4, selectmode=EXTENDED)
lb.exportselection = False
But that doesn't work at all in my apps. (Tried on Tkinter 8.5 and Tkinter 8.6.1, Python 3.3, Python 3.4... on a variety of Linux distributions. The problem is remarkably constant, regardless of the app in which the listobox is, or the environment in which it's deployed.)
Ideas?
You are doing it wrong. You need to use the config (or configure) method:
lb.configure(exportselection=False)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With