我已经创建了一个pythongui应用程序。它工作得很好,除了组合框之外,我已经按我的喜好设计了所有的样式。在ttk.组合框好像不管用。在
这应该能让我知道我想要的材料风格。这是组合框的样式块。在
globalStyle = ttk.Style()
globalStyle.configure('TCombobox', foreground=textColor, background=backgroundColor, fieldbackground=selectColor, fieldforeground=textColor, font='Verdana')
我唯一能成功改变的就是文本和前景颜色。我要编辑以下属性:
文本颜色 现场背景 下拉文本颜色 下拉式背景
编辑:我应该提到使用的颜色变量都是有效的十六进制颜色代码。在
^{pr2}$
我知道这个问题已经有半年了,但我也遇到了类似的问题,并设法解决了。要更改ttk组合框弹出框的颜色,可以使用以下代码:
我不确定我是否正确理解了tk的风格机制。 至少上面的代码适用于python3.2和python3.4
所以我遇到了同样的问题,但找到了大部分的解决方案here。您只需在代码中添加以下内容:
然后要更改框内的字体(当下拉列表不存在时),请在代码中添加
font='font_style'
。在所以在我的案例中我有:
^{pr2}$确保还具有以下导入:
我的问题是我只能更改实际框的背景色(当下拉框不存在时)。我仍在尝试如何更改字体颜色(前景对我不起作用),以及方框本身的颜色。所以如果有人能补充这个答案那就太好了!在
相关问题 更多 >
编程相关推荐