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

≡放荡痞女 提交于 2021-02-04 13:51:25

问题


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


回答1:


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()


来源:https://stackoverflow.com/questions/31545559/how-to-change-background-color-in-ttk-comboboxs-listview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!