如何在 ttk.Combobox 的列表视图中更改背景颜色?

Mar*_*ece 6 python listview combobox tkinter

如何更改组合框列表视图的样式?

这是到目前为止的部分代码:

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)
Run Code Online (Sandbox Code Playgroud)

如何访问组合框的列表视图的样式?

示例图像:

在此处输入图片说明

Mar*_*ece 8

找到了!改变combobox的listview的BG的方法是:

import ttk
import Tkinter
root = Tkinter.Tk()

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

combo = ttk.Combobox().pack()
root.mainloop()
Run Code Online (Sandbox Code Playgroud)