python - 如何更改 ttk.Combobox ListView 中的背景颜色?

标签 python listview combobox tkinter

如何更改组合框 ListView 的样式?

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

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)

如何访问组合框 ListView 的样式?

示例图片:

enter image description here

最佳答案

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

import ttk
import Tkinter
root = Tkinter.Tk()

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

combo = ttk.Combobox().pack()
root.mainloop()

关于python - 如何更改 ttk.Combobox ListView 中的背景颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31545559/

相关文章:

python - `list(itertools.groupy)` 的违反直觉的行为

python - 如何在python 3中将列表附加到嵌套列表?

python - pip 在 Mac OS X Lion 上安装 django 超时

java - 当子类化数组适配器时,无法从多 ListView 中获取选定的项目

安卓应用 : custom listview with image

android - 如果受主题颜色影响, ListView 的颜色

wpf - 键入时组合框换行

c# - 对象数据绑定(bind) c# winforms 不工作

python - 如何快速绘制 10000+ 二维图形对象?

java - ComboBox 和计算出现问题