Open ShawezA opened 2 months ago
I was able to fix it by changing the deselect function:
def deselect(self, index): if not self.multiple: if self.selected: self.selected.configure(fg_color=self.button_fg_color) self.selected = None return if index in self.buttons and self.buttons[index] in self.selections: self.selections.remove(self.buttons[index]) self.buttons[index].configure(fg_color=self.button_fg_color)
Prettier printed (BTW I also struggle with the GitHub editor ! ;)):
def deselect(self, index):
if not self.multiple:
if self.selected:
self.selected.configure(fg_color=self.button_fg_color)
self.selected = None
return
if index in self.buttons and self.buttons[index] in self.selections:
self.selections.remove(self.buttons[index])
self.buttons[index].configure(fg_color=self.button_fg_color)
Tested and approved !
If you try to delete an empty listbox using listbox.delete("all", tkinter.END) you get this error: line 178, in deselect
if self.buttons[index] in self.selections: