How to control the tkinter combobox selection highlighting How to control the tkinter combobox selection highlighting tkinter tkinter

How to control the tkinter combobox selection highlighting


You can use the Combobox's selection_clear() method to clear the selection whenever you want. e.g

inUnitsValue.selection_clear()


Could it be that with a readonly combobox the problem is not the selection but the relatively strong focus-indicator?

With this workarround you lose the ability to control your program by keyboard. To do it right you would have to change the style of the focus-highlighting.

from tkinter import *from ttk import *def defocus(event):    event.widget.master.focus_set()root = Tk()comboBox = Combobox(root, state="readonly", values=("a", "b", "c"))comboBox.grid()comboBox.set("a")comboBox.bind("<FocusIn>", defocus)mainloop()