Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change background color in ttk.Combobox's listview?

How can I change the style of the combobox's listview?

Here is part of the code so far:

style = ttk.Style()
style.configure("BW.TLabel", foreground="black", background="#20252b",
                insertbackground="white", fieldbackground= 'blue')
optmn = ttk.Combobox(self, style="BW.TLabel")
optmn.place(x=140, y=200, width=150, height=25)

How can I access the style of the listview of the combobox?

Sample Image:

enter image description here

like image 824
Mario Pece Avatar asked Jul 21 '15 17:07

Mario Pece


1 Answers

Found it! the way to change the BG of the listview of the combobox is:

import ttk
import Tkinter
root = Tkinter.Tk()

root.option_add("*TCombobox*Listbox*Background", 'green')

combo = ttk.Combobox().pack()
root.mainloop()
like image 145
Mario Pece Avatar answered Nov 14 '22 23:11

Mario Pece