I’m using a ComboBox as part of a larger GUI, written in python/tkinter.
When the drop-down selection is changed, the color is updated to indicate to the user that something has changed.
However, the combobox also allows the user to type in their own value. I also want the color to change when this happens.
The problem is, I don’t see anything in the ComboBox documentation indicating how to do this.
I noticed that somewhere in Python’s
Tkinterdocs, it mentions thatComboboxis a subclass ofEntry.With an
Entry, here’s what you do. Set the configuration:-validatecommandshould be set to the thing that you want to happen when a key is pressed (in my case, change a color).-validateshould be set tokey, meaning that the validation command will be called whenever a key is pressed while the cursor is in the entry.Here’s the tk page on text entries for further reference.
Doing the exact same thing for comboboxes works just the same way (as far as I can tell).