所选组合框的背景颜色/默认值

时间:2019-03-24 13:36:40

标签: python tkinter combobox

我希望将tkinter组合框的默认白色更改为橙​​色,并在选择时将其更改为绿色。我找不到如何定位完整字段,只能更改字体颜色。

image1

我搜索了论坛和网络,但找不到任何解决方案。 我设法将列表框的颜色设置为橙色,但不是默认值。

image2

列表框背景

window.option_add("*TCombobox*Listbox*Background", 'orange')

我的组合框样式

ttk.Style().layout('combostyleO.TCombobox')
ttk.Style().configure('combostyleO.TCombobox', selectforeground='black', selectbackground='orange', background='green', foreground='orange', padding=4)

创建组合框

lendersR = StringVar(window)
lendersR.set('Select lender')  # set the default option
choicesR = excel.Excel().get_resi_lenders_from_csv()
choicesR = sorted(choicesR)
lenderMenuR = ttk.Combobox(window, width=55, height=30, font="Courier 10", textvariable=lendersR, values=choicesR, style="combostyleO.TCombobox")

0 个答案:

没有答案
相关问题