I am trying to color my tkinter treeview using tags but it doesn't work even tho I have followed a few tutorials and I think I am doing everything the right way.
self.sidebar_button_event()
self.ultimo = "Inventario"
self.cajas_frame = customtkinter.CTkTabview(self, height=250)
self.cajas_frame.add("Cajas")
self.cajas_frame.tab("Cajas").grid_columnconfigure(0, weight=1)
self.cajas_frame.tab("Cajas").grid_rowconfigure(0, weight=1)
self.cajas_frame.grid(row=0, column=1, padx=(20, 20), pady=(20, 20), sticky="new", columnspan=3)
self.setTablaCajas()
n = 0
for f in self.inventario.datosCajas():
if n % 2 == 0:
self.cajas.insert(parent='', index='end', iid=n, values=f, tags=('par',))
else:
self.cajas.insert(parent='', index='end', iid=n, values=f, tags=('impar',))
self.cajas.bind("<<TreeviewSelect>>", self.clickCajas)
n += 1
n = 0
self.cajas.tag_configure('par', background='orange', )
self.cajas.tag_configure('impar', background='purple')
Could it be because of me using customtkinter
and tkinter
?
PS: I already tried using Style.configure
and it does change it's appearance, but it doesn't seem to work this way and I want odd and even rows to have a different color.