tkinter (ttk) combobox dropdown text is white on white

Christian Gollwitzer auriocus at gmx.de
Sun Jun 3 17:01:40 EDT 2018


Am 03.06.18 um 21:54 schrieb Jim Lee:> import tkinter as tk
> from tkinter import ttk
> 
> root = tk.Tk()
> cb = ttk.Combobox(root)
> cb.grid(row=0, column=0, sticky='NSEW')
> cb['values'] = ['one', 'two', 'three', 'four']
> root.mainloop()
> 
> The text of the values in the combobox dropdown list is white on 
> white.   The *selected* item in the list is white on light grey, but all 
> the unselected items are invisible (white on white). 

Which platform are you on, i.e. which operating system? I guess it is 
Linux. In that case the default colors are read by Tk from the X11 
options database, which is some cruft from the past to set options for 
X11 applications. Try to run

	xrdb -query

That should give you a list of default values, and maybe you can see 
something. The dropdown list is actually a popdown menu, so look for 
Menu colors. For instance, if you use a dark theme in your desktop 
environment, it could be that the foreground is correctly set to white, 
but the background is hardcoded white for some reason e.g.
	

	Christian



More information about the Python-list mailing list