Python Forum
[Tkinter] Can I set background color for each item in tkinter Combobox? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: GUI (https://python-forum.io/forum-10.html)
+--- Thread: [Tkinter] Can I set background color for each item in tkinter Combobox? (/thread-31435.html)



Can I set background color for each item in tkinter Combobox? - water - Dec-10-2020

Can I insert color block for each item in tkinter 'Combobox',
like this:
[Image: 1a32077.png]

or set background color for each item in tkinter 'Combobox'?
like this:
[Image: 11235.jpg]


RE: Can I set background color for each item in tkinter Combobox? - Larz60+ - Dec-10-2020

There's a Combobox option tk_setPalette,
but the name implies a canvas background, I don't know this to be fact, just an assumption.

If this is true, you can probably use pmw to create a custom window that will
allow individual item colors, but out of the box, I think you're stuck with a single color.
Howvere, nothing is to stop you from coloring the text of each item.
Output:
| tk_setPalette(self, *args, **kw) | Set a new color scheme for all widget elements. | | A single color as argument will cause that all colors of Tk | widget elements are derived from this. | Alternatively several keyword parameters and its associated | colors can be given. The following keywords are valid: | activeBackground, foreground, selectColor, | activeForeground, highlightBackground, selectBackground, | background, highlightColor, selectForeground, | disabledForeground, insertBackground, troughColor.