TTK 组合框样式不正确

问题描述

我一直在尝试创建一个适合我的 UI 其余部分的组合框;但是小部件仍然看起来像默认的:

A default ttk combobox

在我的尝试中,我尝试使用以下代码“强制”小部件适应颜色,但无济于事:

self.root = tk.Tk() # Parent Container

# Other UI elements declared

self.themeSel_combo_theme.configure(
    "TCombobox",background=self.theme.get('bg'),foreground=self.theme.get('bg'),fieldbackground=self.theme.get('bg'),darkcolor=self.theme.get('bg'),lightcolor=self.theme.get('bg'),selectbackground=self.theme.get('bg'),selectforeground=self.theme.get('bg'),bordercolor=self.theme.get('bg'),insertcolor=self.theme.get('bg'),insertwidth=self.theme.get('bg'),# It uses a color,not a size value
    arrowcolor=self.theme.get('bg')
)

self.themeSel_combo = ttk.Combobox(self.quickTheme_cont,style="TCombobox")

以上代码使用 this website 作为参考。

注意 self.theme.get('bg') 返回 #202020

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)