Python Forum
[Tkinter] Can I set background color for each item in tkinter Combobox?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Can I set background color for each item in tkinter Combobox?
#1
Question 
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]
Reply
#2
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Photo Tkinter TEXT background image _ShevaKadu 5 2,721 Nov-02-2020, 10:34 AM
Last Post: joe_momma
  Tkinter - How can I remove the background borders from ttk.Button? TurboC 4 4,686 Oct-18-2020, 10:58 AM
Last Post: TurboC
  tkinter | Button color text on Click Maryan 2 866 Oct-09-2020, 08:56 PM
Last Post: Maryan
  Tkinter - How can I change the default Notebook border color? TurboC 4 4,196 Oct-06-2020, 10:35 PM
Last Post: TurboC
  [tkinter] color change for hovering over button teacher 4 3,136 Jul-04-2020, 06:33 AM
Last Post: teacher
  Convert combobox user input in to date with tkinter Ame 8 2,519 Jul-01-2020, 09:40 PM
Last Post: Yoriz
  TKINTER - Change font color for night or day Ayckinn 2 1,412 May-24-2020, 09:25 PM
Last Post: Ayckinn
  Tkinter help (color) Florent 2 878 Mar-01-2020, 02:59 PM
Last Post: Florent
  [Tkinter] Tkinter delete combobox content and not the list LagratteCchouette 4 4,181 Dec-29-2019, 11:04 AM
Last Post: LagratteCchouette
  Restoring Tkinter widget background to original color pythonprogrammer 1 1,174 Dec-16-2019, 04:59 AM
Last Post: woooee

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020