如何在ttk.Combobox的列表视图中更改背景颜色? [英] How to change background color in ttk.Combobox's listview?

查看:89
本文介绍了如何在ttk.Combobox的列表视图中更改背景颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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?

示例图片:

推荐答案

找到了!更改组合框列表视图的BG的方法是:

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

这篇关于如何在ttk.Combobox的列表视图中更改背景颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆