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
  My Background Image Is Not Appearing (Python Tkinter) HailyMary 2 3,858 Mar-14-2023, 06:13 PM
Last Post: deanhystad
  Tkinter - How can I change the default Notebook border color? TurboC 5 14,565 May-23-2022, 03:44 PM
Last Post: bigmac
  [Tkinter] Background inactivity timer when tkinter window is not active DBox 4 2,838 Apr-16-2022, 04:04 PM
Last Post: DBox
  Can't get tkinter button to change color based on changes in data dford 4 3,314 Feb-13-2022, 01:57 PM
Last Post: dford
  [PyQt] How can I sync Combobox index to other combobox index? nickzsche 2 2,309 Jan-03-2022, 12:29 PM
Last Post: Axel_Erfurt
Photo Tkinter TEXT background image _ShevaKadu 5 7,563 Nov-02-2020, 10:34 AM
Last Post: joe_momma
  Tkinter - How can I remove the background borders from ttk.Button? TurboC 4 16,672 Oct-18-2020, 10:58 AM
Last Post: TurboC
  tkinter | Button color text on Click Maryan 2 3,296 Oct-09-2020, 08:56 PM
Last Post: Maryan
  [tkinter] color change for hovering over button teacher 4 8,260 Jul-04-2020, 06:33 AM
Last Post: teacher
  Convert combobox user input in to date with tkinter Ame 8 6,609 Jul-01-2020, 09:40 PM
Last Post: Yoriz

Forum Jump:

User Panel Messages

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