I have been attempting to create a combobox that fits in with the rest of my UI; however the widget still looks like the default:
In my attempts, I have tried to "brute-force" the widget into adapting to the color with the following code but to no avail:
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")
The code above was made using this website as a reference.
Note that self.theme.get('bg')
returns #202020
Apologies for the inconvenience; I've decided to keep this thread in case someone else needs help with this. It turns out that using the following command for creating the parent container makes it so that ttk
objects do not style properly:
self.root = tk.Tk()
Changing the aforementioned command to the following fixed the issue I was having:
self.root = tk.Toplevel()