我正在尝试将 tkinter 中组合框的背景颜色更改为红色。但我无法做到这一点,请帮忙。这是我的代码'''
#code
style = ttk.Style()
style.map('TCombobox', fieldbackground=[('readonly','red')])
style.map('TCombobox', selectbackground=[('readonly', 'red')])
style.map('TCombobox', selectforeground=[('readonly', 'white')])
n= tk.StringVar(value=download_choices[0])
n.set(download_choices[0])
youtubeChoicesLabel = ttk.Combobox(root, font=font, justify='center', textvariable=n, values=download_choices)
youtubeChoicesLabel["state"] = "readonly"
youtubeChoicesLabel.bind('<<ComboboxSelected>>')
youtubeChoicesLabel.current(0)
# youtubeChoicesLabel["selectbackground"] = '#ff0000'
# youtubeChoicesLabel["foreground"] = '#000000'
youtubeChoicesLabel.pack(side=TOP, pady=20)
'''
慕尼黑8549860
相关分类