mein Betriebssystem ist Kubuntu 14.04.
Beim Versuch ein dunkles Farbschema zu verwenden, habe ich das Problem dass meine ttk.Combobox weiße Schrift auf weißen Hintergrund anzeigt.
Beim Googeln, ob man background und foreground in der ttk.Combobox ändern kann, konnte ich nichts aussagekräftiges finden.
Folgende Codes (mit #*# gekennzeichnet) habe ich eingebaut, leider ohne Erfolg auf Änderung von background und foreground:
Code: Alles auswählen
# ComboBoxFeld
self.cb_frame = tk.Label(self.window)
self.cb_frame.pack(expand=True, anchor=tk.CENTER)
# create the self.combo box
s = ttk.Style() #*#
print(s.element_options('TCombobox')) #*#
print(s.lookup('TCombobox.foreground', 'foreground')) #*#
s.configure('TCombobox', bg='red', fg='green') #*#
print(s.lookup('TCombobox.foreground', 'foreground')) #*#
print(s.configure('TCombobox')) #*#
self.combo = ttk.Combobox(self.cb_frame, width=max_width, style='TCombobox') #*#
self.combo.bind('<<ComboboxSelected>>', self.control)
self.combo.bind('<KeyRelease>', self.control)
self.combo.bind('<Button-1>', self.control)
# load the self.combo box with the list
self.key2combo = dict()
self.combobox_list = [self.i2name[key]
for key in sorted(self.i2name)]
self.combo['values'] = self.combobox_list
# pack the widgets vertically in this order
self.combo.pack(expand=True, anchor=tk.CENTER)
self.combo.focus_set()
Code: Alles auswählen
()
#000000
#000000
{'padding': 1, 'fg': 'green', 'arrowsize': '12', 'bg': 'red'
Grüße Nobuddy